Error '1004' in WorksheetFunction

O

oakman

Greetings to all,
First off, I would like to thank anyone who can help me. I appreciat
your effort and your time.
When I run the procedure below, I get a run-time error 1004 with th
following message "Unable to get the VLookup property of th
WorksheetFunction class".
I started by typing the code and then chose to use the pull down men
for the property in hopes that this would fix the error. However, i
did not work.
I am greatful for any assistance.

Sub Get_NY_Contract()
Dim Contract As Variant
Dim Flow As Double

Contract = InputBox("Enter NY Contract Number")
Sheets(1).Activate
Flow = WorksheetFunction.VLookup _
(Contract, Range("E:I"), 5, False)

MsgBox Contract & "DA" & Flow
End Su
 
D

Don Guillett

try this from anywhere in the workbook
Sub LookupVBA()
Dim contract As Integer
myrng = Sheets("sheet9").Range("E:I")
contract = InputBox("Enter NY Contract Number")
Flow = Application.VLookup(contract, myrng, 5, False)
MsgBox contract & "DA" & Flow
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top