Error 1004 in WorksheetFunction.VLookup

G

Guest

What could POSSIBLY be causing the error 1004 on this code:

Dim LookLU2 as Range
Dim Stats as Variant

Set LookLU2 = Workbooks("PRProc.xls").Names("StatsAcc").RefersToRange
Stats = Application.WorksheetFunction.VLookup("112001", LookLU2, 2, False)

The file is open, the lookup works when I do it manually. I don't get it.
Any ideas?
 
G

Guest

Runtime error 1004.
Unable to get the vlookup property from the worksheetfunction class!
 
B

Bob Phillips

Try

Stats = Application.WorksheetFunction.VLookup(112001, LookLU2, 2, False)


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

I should have known! I have only used this
application.worksheetfunction.vlookup one other time and kept thinking it was
something with my naming the range or something. But it is just the fact
that the data in one place is a number and in the other is text. I should
have figured that out. Thanks for being there for me. I just spent the last
1.5 hours trying to figure what was wrong withe code. When all along, I just
had a loose nut on the keyboard!
 

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

Top