Hi,
I'm using vlookup and sometimes I get the mismatch error because the cell it retrieves has an error (NA to be more precise), which is ok, but I want to get an msgbox and exit the sub when that happens.
This is the part of the code where I have the vlookup:
Thank you.
I'm using vlookup and sometimes I get the mismatch error because the cell it retrieves has an error (NA to be more precise), which is ok, but I want to get an msgbox and exit the sub when that happens.
This is the part of the code where I have the vlookup:
Code:
Dim price As Double
price = Application.VLookup(Location, lk_range, 10, False)
If IsError(price) Then
MsgBox ("The price is not available for that location")
ActiveWorkbook.Close
Exit Sub
End If
Thank you.