PDA

View Full Version : Solved: VLookup in VBA



Opv
04-20-2010, 08:49 AM
Why is the code below receiving a "Application-defined or Object-defined error"?


Dim myTerm As String

myTerm = Application.WorksheetFunction.VLookup(Range("A2"), Worksheets("Database").Range("A4", Range("B4").End(xlDown)), 2, False)

lucas
04-20-2010, 08:55 AM
You didn't test to see if the range was empty. If there is data it works. See attached.

Opv
04-20-2010, 09:13 AM
You didn't test to see if the range was empty. If there is data it works. See attached.

Thanks,

Opv