Info about "WorksheetFunction.VLookup"

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
687
Office Version
  1. 2007
Platform
  1. Windows
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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hello Maurizio,

Does that not work for you? Can you explain what does/does not work here?
 
Upvote 0
Hi firefytr,

with Excel 2000 on Win98Se I get:

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


Bye.
 
Upvote 0
That means the value was not found in the left-most column of your range given.
 
Upvote 0
Sorry, but is not so!

"That means the value was not found in the left-most column of your range given".

solution:

MioValore = Application.WorksheetFunction.VLookup(NrFT * 1 ,Worksheets("Cee").Range("A:J"), 6, False)
 
Upvote 0
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.
 
Upvote 0
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)
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top