Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default VLookup in VBA

Am trying to use the VLookup function in VBA code, and the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default VLookup in VBA

If LFLookup is a variable, then you should not put quotes
around it.

-----Original Message-----
Am trying to use the VLookup function in VBA code, and

the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default VLookup in VBA

Hi Larry;

On thing to look at is that in the code below it has
Worksheets(2) which is referring to the sheet by index. I
would try switching it to the actual name such as
WorkSheets("MyWorkSheetName")

Thanks,

Greg
-----Original Message-----
Am trying to use the VLookup function in VBA code, and

the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VLookup in VBA

intPointValue = Application.VLookup(varRawData, _
Worksheets(2).Range("LFLookup"), 9, True)

Using just application will often allow it to work.

--
Regards,
Tom Ogilvy

"LarryP" wrote in message
...
Am trying to use the VLookup function in VBA code, and the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VLookup in VBA

If "LFLookup" is a range in the worksheet replace the quotes with square braces.
eg.... .Range([LFLookup]), etc
--
Paul M


"LarryP" wrote:

Am trying to use the VLookup function in VBA code, and the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VLookup in VBA

that would cause an error.

Either

..Range("LFLookup"),

or

[LFLookup]

would work, but not combined. Since there is nothing wrong with that part
of the code as written (as long as LFLookup is on worksheets(2)) then there
is no reason to change it.

--
Regards,
Tom Ogilvy



"Twoo Doggs" wrote in message
...
If "LFLookup" is a range in the worksheet replace the quotes with square

braces.
eg.... .Range([LFLookup]), etc
--
Paul M


"LarryP" wrote:

Am trying to use the VLookup function in VBA code, and the
following line won't run:

intPointValue = Application.WorksheetFunction.VLookup
(varRawData, Worksheets(2).Range("LFLookup"), 9, True)

I get runtime error 1004, "Unable to get the VLookup
property of the WorksheetFunction class."

What am I missing? I tried several variations but can't
seem to make VLookup work, even though the Help says it
will. Any hints most appreciated.



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
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
VLookUp - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 01:27 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"