Hi All,
I am trying to using the vlookup formula as mentioned below.
Sub Vlookup()
Dim i As Integer
For i = 2 To 155
Range("B" & i) = Application.WorksheetFunction.Vlookup(Sheets("sheet1").Range("A" & i), Sheets("Sheet2").Range("A1:B155"), 1, False)
Next i
End Sub
Data information
Sheet1 data is present in sheet2.
Sheet2 data is present in sheet1.
Not all the data of sheet1 is in sheet2.
And not all the data of sheet2 is in sheet1.
Issue: when I am running the macro, it runs till the data which is not available at the sheet2.and then it give me an error 1004.
I think when data is not matching the instead of getting #NA I getting this error which is stopping my macro with error.
Could someone help me how to handle the #NA error in macro when I run the macro.
Please see the attached file for your reference.
Regards,
Waqar
Bookmarks