#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLookup a Vlookup adamb2000 Excel Worksheet Functions 4 June 28th 06 10:54 PM
VLOOKUP Problem Ian Excel Discussion (Misc queries) 3 April 6th 06 06:47 PM
VLOOKUP Limitations chris_manning Excel Worksheet Functions 2 August 9th 05 06:23 PM
Have Vlookup return a Value of 0 instead of #N/A Mr Mike Excel Worksheet Functions 4 May 25th 05 04:51 PM
vlookup data hidden within worksheet Excel Worksheet Functions 0 January 26th 05 12:09 PM


All times are GMT +1. The time now is 06:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"