alexaronson
Active Member
- Joined
- Sep 30, 2005
- Messages
- 314
Hello and thank you for looking at my question.
I have the following vlookup VBA code
The issue I am having is that when there is an error from not finding the record located at dataWS.Range("A1:D" & LastRow) the code is populating cell tpmWS.Cell(i,j+14) with the value from above.
For instance, row 1 returned a value of 100. row 2 has no matching record which should provide an error. Instead, I get the value of 100.
Any suggestions on how I should proceed to correct my issue?
Thanks
I have the following vlookup VBA code
Code:
On Error Resume Next
x = WorksheetFunction.VLookup(tpmWS.Cells(i, j), dataWS.Range("A1:D" & LastRow), 4, False)
If Err.Number = 0 Then tpmWS.Cells(i, j + 14) = x
The issue I am having is that when there is an error from not finding the record located at dataWS.Range("A1:D" & LastRow) the code is populating cell tpmWS.Cell(i,j+14) with the value from above.
For instance, row 1 returned a value of 100. row 2 has no matching record which should provide an error. Instead, I get the value of 100.
Any suggestions on how I should proceed to correct my issue?
Thanks