View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dale Fye Dale Fye is offline
external usenet poster
 
Posts: 169
Default Using vLookup function in VBA

I'm an Access programmer, venturing into Excel VBA.

I have a form that contains a text value ("1.1.6") that is one of many
values in my TaskInfo Worksheet. I want to use Vlookup to get the values in
the 2nd, 3rd, and 4th columns of this worksheet, but cannot seem to make it
work. My code segment looks like:

Dim lookupRange as range
set lookupRange = Worksheets("TaskInfo").Range("A2:A200")

me.text2.Value = application.worksheetfunction.vlookup("1.1.6", lookupRange,
2)

But this generates a runtime error 1004:
Unable to get the Vlookup property of the WorksheetFunction class

When set the lookupRange in the Immediate window, I am able to debug.print
lookupRange(1), etc, so I know the range is defined properly, but have know
idea why I am getting this error message.

Any help would be greatly appreciated.


--
Email address is not valid.
Please reply to newsgroup only.