Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VLOOKUP error in VBA
Hi,
I am doing some VLookups in visual basic and am running into an issue. Basically, I am running 7 vlookups on the same value in different columns. If the vlookup does not return an error, I want to report the number in column 3 of the range; if it is an error (ie, the lookup value does not exist in the range), I want to report a 0. When the lookup value exists, my formula works fine. However, when it does not exist, the macro always ends with a run-time error. I tried to get around this using: If IsError(Application.WorksheetFunction.VLookup(Arg1 , Arg2, 3, False)) = True Then myVar = 0 Else myVar = Application.WorksheetFunction.VLookup(Arg1, Arg2, 3, False) End If However, it still stops with a runtime error on the If IsError line. How can I work around this? Thanks! Brett |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VLookup a Vlookup | Excel Worksheet Functions | |||
VLOOKUP Problem | Excel Discussion (Misc queries) | |||
VLOOKUP Limitations | Excel Worksheet Functions | |||
Have Vlookup return a Value of 0 instead of #N/A | Excel Worksheet Functions | |||
vlookup data hidden within worksheet | Excel Worksheet Functions |