Unable to get the Vlookup Property of the WorkSheetFunction Class

M

monagan

(RunTime Error 1004)Unable to get the Vlookup Property of th
WorkSheetFunction Class is the error I get when I try to run

Range("i23", "i23").Value = WorksheetFunction.VLookup(ComboBox2.Text
Worksheets("Turbine").Range("A67:x127"), 2, False)

It works a few times, then stop
 
F

Frank Kabel

Hi
try:
Range("i23").Value = WorksheetFunction.VLookup(ComboBox2.Text,
Worksheets("Turbine").Range("A67:x127"), 2, False)
 
T

Tom Ogilvy

That is because it doesn't find the value in Combobox2.text more than
likely.

Try it this way

Dim var as Variant
var = Application.VLookup(ComboBox2.Text, _
Worksheets("Turbine").Range("A67:x127"), 2, False)
if iserror(var) then
Range("I23").Value = Combobox2.Text & " not found"
else
Range("I23").Value = var
End if
 

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