Error 1004

J

John

Hi.
The error 1004 message (imposible to get the VLookup
property of the WorksheetFunction class) appears when the
debugger reaches the next line:

Worksheets("graf").Range("E15").Value =
Application.WorksheetFunction.VLookup(numero, refa, 147,
falso)

I've declared:
Dim numero As Integer
Dim refa As Range
Set refa = Worksheets("refa").Range("A1:EP229")
numero = Val(frmConsulta.cboNo.Value)

Any idea?
 
D

David Adamson

I think you set the lookup value in the vlookup command wrong.

You are asking it to find the data in column 147

Yet your data range only goes to EP which is column number 146

You will need to select the correct column for the data to look up.

Vlookup(this value, range, value to return, 1 or 0)
 
Top