Vlookup in VB not returning anything error

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

Hi, I am trying to get the following working:


If Application.WorksheetFunction.IsNA(Application. _
WorksheetFunction.VLookup(lookUpValue,
myRange, 1, False)) = False Then

I have tested it where it should not be able to find
anything from the vlookup and it causes an error of 1004
unable to get the vlookup property of the worksheet class.

How would I go about getting this to work?

Thanks,
Grant.
 
dim res as Variant
res = VLookup(lookUpValue,myRange, 1, False)
if not iserror(res) then

' don't use Worksheetfunction
 
Returns sub or function not defined error.

-----Original Message-----
dim res as Variant
res = VLookup(lookUpValue,myRange, 1, False)
if not iserror(res) then

' don't use Worksheetfunction

--
Regards,
Tom Ogilvy





.
 
Hi Grant,

I think there was a typo and Tom intended:

res = Application.VLookup(lookUpValue,myRange, 1, False)
 
my typo - editing your code, I deleted application as well and forgot to
add it back.

res = Application.vlookup(lookUpValue, myRange, 1, False)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top