#### Maurizio

##### Well-known Member
Hi all,
how can I to transform:

MioValore =Application.WorksheetFunction.VLookup(Worksheets("Report").Range("A2"),Worksheets("Cee").Range("A:J"), 6, False

with:

NrFT = InputBox("Input N° Document", "Hi")

i.e.:

MioValore = Application.WorksheetFunction.VLookup(NrFT,Worksheets("Cee").Range("A:J"), 6, False)

Tia.

### Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

#### Zack Barresse

##### MrExcel MVP
Hello Maurizio,

Does that not work for you? Can you explain what does/does not work here?

#### Maurizio

##### Well-known Member
Hi firefytr,

with Excel 2000 on Win98Se I get:

error run-time 1004: impossible to find property of Vlookup on class WorksheetFunction.

Bye.

#### Maurizio

##### Well-known Member

Sorry, but is not so!

solution:

MioValore = Application.WorksheetFunction.VLookup(NrFT * 1 ,Worksheets("Cee").Range("A:J"), 6, False)

#### just_jon

##### Legend
You were trying to locate a String in a numeric range - coercing it via * 1 as you've found, will fix that.

Also see the VBA Cdbl() function.

#### Maurizio

##### Well-known Member
Ok just_jon,
so this solution is best:

Code:
``````NrFT = Application.InputBox("Input N° Doc", "Ciao")

If IsNumeric(NrFT) Then
NrFT = CDbl(NrFT)
'MsgBox (" i.e. Nr")
Else
'MsgBox (" i.e. txt")
End If

MsgBox Application.VLookup(NrFT, Worksheets("Cee").Range("A:B"), 2, False)``````

#### just_jon

##### Legend
Maurizio said:
Ok just_jon,
so this solution is best:

NrFT = Application.InputBox("Input N° Doc", "Ciao")

If IsNumeric(NrFT) Then
NrFT = CDbl(NrFT)
'MsgBox (" i.e. Nr")
Else
'MsgBox (" i.e. txt")
End If

MsgBox Application.VLookup(NrFT, Worksheets("Cee").Range("A:B"), 2, False)

I would do:

Dim NfFT as Long
NrFT = Application.InputBox("Input N° Doc", "Ciao")
MsgBox Application.VLookup(NrFT, Worksheets("Cee").Range("A:B"), 2, False)

as long as you know the intended input needs to be found in a numeric range A

Replies
9
Views
302
Replies
7
Views
66
Replies
17
Views
160
Replies
1
Views
56
Replies
4
Views
86