Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Vlookup Error in Visual Basic
Hi,
I want to check to see if I get an error using VLOOKUP in visual basic. If I do, I want something to happen; if not, skip over that step. This is how I have it set up right now: If IsError(Application.WorksheetFunction.VLookup(Cell s(4, 5).Value, CDSPremiumsRange, 1, False)) = True Then .... However, when it gets to this step and it is an error, I get a runtime error message instead of it going to my code for what happens when that If statement is true. Can someone help?? Thanks! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Vlookup Error in Visual Basic
Drop the .worksheetfunction from your line of code.
Application.worksheetfunction.vlookup() raises a runtime error if there's no match. Application.vlookup() returns an error that you can check with iserror(). wrote: Hi, I want to check to see if I get an error using VLOOKUP in visual basic. If I do, I want something to happen; if not, skip over that step. This is how I have it set up right now: If IsError(Application.WorksheetFunction.VLookup(Cell s(4, 5).Value, CDSPremiumsRange, 1, False)) = True Then ... However, when it gets to this step and it is an error, I get a runtime error message instead of it going to my code for what happens when that If statement is true. Can someone help?? Thanks! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Visual Basic Error | Excel Discussion (Misc queries) | |||
Microsoft Visual Basic: Compile error: Sum or Function not defined | Excel Worksheet Functions | |||
MS Visual Basic error on Launch | Setting up and Configuration of Excel | |||
Visual basic Check Box and the IF formula | Excel Discussion (Misc queries) | |||
Formula in Visual Basic For Excel | Excel Discussion (Misc queries) |