Thread: VLOOKUP and VBA
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default VLOOKUP and VBA

You don't need the .worksheetfunction in your code.

Can you get a formula similar to this working in excel?

=vlookup("something",Statics_Query_from_MS_Access_ Database, 2,false)

(I like Bernie's suggestion.)

Barb Reinhardt wrote:

I'm not sure what I need. That's why I'm asking. Defining what I'd call a
constant based on data in the workbook is new to me.

"John" wrote:

Hi Barb,

Do you need the WorksheetFunction object in there?

ie "Application.WorksheetFunction.VLookup(......"

Best regards

John

"Barb Reinhardt" wrote in message
...
I thought I posted this, but I can't find it now so it's possible it never
was posted. If it's a duplicate, my apologies.

I have the following equation that's not working and I'm not sure why

CompanyID = Application.VLookup(Target, Range("Statics
Query_from_MS_Access_Database"), 2, False)

I get
runtime error 1004.
Method 'range' of object '_worksheet' failed

I have a named range of Query ... on the Statics worksheet.

Thanks,
Barb Reinhardt










--

Dave Peterson