ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vlookup error (https://www.excelbanter.com/excel-programming/338768-vlookup-error.html)

ALEX

Vlookup error
 
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

ALEX

Vlookup error
 
Thanks, I've already fixed it.

"Alex" wrote:

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


Patrick Molloy[_2_]

Vlookup error
 
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.


"Alex" wrote:

Thanks, I've already fixed it.

"Alex" wrote:

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



All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com