I have a macro with a vlookup statement and I know that from time to time the macro is going to bomb because I know that my users will not always correctly update the range the lookup statement refers to. When the program bombs, I want there to just be either a blank cell or a zero and ANYTHING other than a number populated in the targeted cell where my result goes. I've tried using "On Error Resume Next" in my code. This prevents my macro from crashing, but for some reason, the last legitimate answer from the previous row is entered in the row where it should bomb. So for example, the cell of the previous row shows $50 which is correct, but then in the next row where it should show nothing or a zero, it too shows $50.
The relevant code is as follows:
Code:
For counter = custrow To finalrowbilling
custname = Worksheets("billing").Cells(custrow, custcol)
classname = Worksheets("billing").Cells(custrow, classcol)
On Error Resume Next
Price = Application.WorksheetFunction.VLookup(custname, bk, WorksheetFunction.Match(classname, bk2, 0), False)
Worksheets("Billing").Cells(custrow, finalcolbilling).Offset(0, 1) = Price
custrow = custrow + 1
Next counter
Any help would be greatly appreciated.
Bookmarks