Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range("A12").Value = Application.HLookup(1, "H12:EZ12", 1, T

Status
Not open for further replies.

mmartens

Mechanical
Joined
Jul 17, 2001
Messages
24
Location
CA
I am in VB and trying to run the following using the excel function hlookup

Range("A12").Value = Application.HLookup(1, "H12:EZ12", 1, True)

but my out put is

Range("A12").Value = error 2015

can any one see what is wrong. I am at the end on my rope I am not sure what to try

thanks
 
The second argument of HLOOKUP must be a range, not a string variable, so:
Range("A12").Value = Application.HLookup(1, Range("H12:M12"), 1, True)

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
hlookup is a worksheet function, try:
Range("A12").Value = Application.worksheetfuntion.HLookup(1, Range("H12:M12"), 1, True)

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top