S
sylink
The codes below is meant to match the values in columns A of sheet1
and sheet2. And where a match is obtained, corresponding value in
sheet1, column B is copied to sheet2 column B.
The codes, however, appear to not be looping properly. There appear
repetitions of the first value found in sheet1. Pls what is missing
here?
********************************************************************************
Dim MyName As String
Dim Z As Integer
Z = 2
MyName = Sheets("Sheet2").Range("A" & Z).Value
Do While Sheets("Sheet2").Range("A" & Z).Value <> ""
Sheets("Sheet1").Cells.Find(What:=MyName, LookAt:=xlPart,
MatchCase:=False).Activate
Sheets("Sheet2").Range("B" & Z).Value = ActiveCell.Offset(0, 1)
Z = Z + 1
Loop
***********************************************************************************
and sheet2. And where a match is obtained, corresponding value in
sheet1, column B is copied to sheet2 column B.
The codes, however, appear to not be looping properly. There appear
repetitions of the first value found in sheet1. Pls what is missing
here?
********************************************************************************
Dim MyName As String
Dim Z As Integer
Z = 2
MyName = Sheets("Sheet2").Range("A" & Z).Value
Do While Sheets("Sheet2").Range("A" & Z).Value <> ""
Sheets("Sheet1").Cells.Find(What:=MyName, LookAt:=xlPart,
MatchCase:=False).Activate
Sheets("Sheet2").Range("B" & Z).Value = ActiveCell.Offset(0, 1)
Z = Z + 1
Loop
***********************************************************************************