I am trying to Vlookup and autofill a dynamic range.
My codes are as below
Sub test()
Sheets("Data").Select
Dim LastRow As Long
LastRow = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
Range("B2:B" & LastRow).FormulaR1C1 = "= VLOOKUP(A2,Reference!A:B,2,0)"
Application.CutCopyMode = False
End Sub
the Macro runs but it returns
PBU ID
10014 #NAME?
Range("B2:B" & LastRow).FormulaR1C1 = "= VLOOKUP(A2,Reference!A:B,2,0)"
Need help here so the macro auto fills coloum B
Help Please
Sample attached
Bookmarks