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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

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

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,131
Messages
5,835,579
Members
430,368
Latest member
User800

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back