andycapp28
Technical User
I have this code but cannot get it to run into my loop.
Any help would be most welcome.
Requirement is to read all column C in worksheet1 and for each cell check its value for existence in worksheet2. If found then I need to copy the value from worksheet2 activecell -1 into activecell -1 of worksheet1.
Any help would be most welcome.
Requirement is to read all column C in worksheet1 and for each cell check its value for existence in worksheet2. If found then I need to copy the value from worksheet2 activecell -1 into activecell -1 of worksheet1.
Code:
Sub GetImportID()
Dim rLookfor
Dim rLookin
Set rLookfor = Worksheets("Sheet1").Range("B1").End(xlDown)
Set rLookin = Worksheets("Sheet2").Range("C1").End(xlDown)
Do Until ActiveCell.Value = ""
For Each c In rLookfor.Cells
f = rLookin.Find(c.Value)
If ActiveCell.Value = f Then
rLookin(ActiveCell, ActiveCell.Offset(0, -1)).Copy
rLookfor(ActiveCell, ActiveCell.Offset(0, -1)).Paste
End If
Next
rLookfor(ActiveCell, ActiveCell.Offset(1, 0)).Select
Loop
End Sub