ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 1004 (https://www.excelbanter.com/excel-programming/305370-error-1004-a.html)

john

Error 1004
 
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?

David Adamson[_4_]

Error 1004
 
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)



"John" wrote in message
...
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?





All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com