View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default VBA/VLOOKUP Error Message


Hi JimFor,

Try:

Application.WorksheetFunction.Vlookup


---
Regards,
Norman



"JimFor" wrote in message
...
Hi,

I'm trying to us the VLOOKUP function in a VBA program. Decided to try a
simple code so see how things work and I can't get it to work. I am
working in
Sheet 1 of a workbook. Typed the following VBA code:

"Sub ZOO()
Dim INVEN As Double
Cells(1, 3) = VLookup (A1, INVEN, 2)
End Sub"

When I run it I get a compile error telling me that the Sub or Function is
not
defined. I thought the VLOOKUP function would automatically be recogized
by
the program. I admit I am a novice at this but I am slowly learning.
Can
anyone tell me what I am doing wrong? BTW, I type VLOOKUP in all caps
and the
program changes some letters to small.

Thanks