Vlookup error

A

Alex

I'm using very simple Vlookup function that is working very well in a
spreadsheet but in VB it says unable to get Vlookup property in
WorksheetFunction class.

Set rngLogIn = Worksheets("Main").Range("A9")

varName = Application.WorksheetFunction.VLookup(rngLogIn, LoginName, 3, False)

Can anybody help?

Thanks
 
P

Patrick Molloy

I'd assume that you changed rngLogIn to rngLogIn.Value in the function call?

alternative

dim login as string
LogIn = Worksheets("Main").Range("A9").Value
varName = Application.WorksheetFunction.VLookup(LogIn, LoginName, 3, False)

note that if there's no match then VLookup raises an error which you'll need
to handle too.
 

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

Similar Threads

VLookup in VBA Help Needed 9
VLookUp Function 3
Cant find VLookup property 5
VLOOKUP & ISNA 2
Vlookup in VBA 4
VLookup error 4
Defining a dynamic table_array for vlookup 9
VLookup Function in VB 5

Top