I need to write vlook up code in VBA for value in Sheet "Page1_1" and fill G column with value from "Sheet1" column "R" 17. So far I have below but its giving:
unable to get the v lookup property of the work sheet function class:
Function vlookupVBA()
vlookupVBA = "#N/A"
Set ws = Sheets("Page1_1")
Set sh = Sheets("Sheet1")
LastRow = ws.Cells(Rows.Count, "G").End(xlUp).Row
Set TargetRange = sh.Range("R2:G" & LastRow)
On Error Resume Next
result = Application.WorksheetFunction.VLookup(Worksheets("Page1_1").Range("G2"), TargetRange, 17, False)
End Function