Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Vlookup Error

Hello,

I have the following code to perform a lookup:
mtch = Application.WorksheetFunction.VLookup( _
Worksheets("Nabanco").Cells(nr, 14).Value, _
Worksheets("RDMTemp").Range("A1:T5000"), _
20, False)
The error I get is "Run time error 1004, Unable to get the vlookup property
of the WorksheetFUnction class.

Thanks,
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Vlookup Error

Check there is a (valid) value in Cells(nr,14) . If it is 0 you will get
your error message. Otherwise seems to work OK for me.

HTH

"MJRay" wrote:

Hello,

I have the following code to perform a lookup:
mtch = Application.WorksheetFunction.VLookup( _
Worksheets("Nabanco").Cells(nr, 14).Value, _
Worksheets("RDMTemp").Range("A1:T5000"), _
20, False)
The error I get is "Run time error 1004, Unable to get the vlookup property
of the WorksheetFUnction class.

Thanks,
Mike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Vlookup Error

If it's likely that no vlookup result will be found, you'll want to trap the
error something like this:

Sub xxx()
On Error GoTo ErrorHandler
strSRC = Application.WorksheetFunction.VLookup(string, range, column,
False)

'normal code here
'end of normal code
Exit Sub

ErrorHandler:
If Err = 1004 Then 'couldn't find a match
MsgBox "No results could be found", vbOKOnly, "Error"
Err.Clear
End If

End Sub


"Toppers" wrote:

Check there is a (valid) value in Cells(nr,14) . If it is 0 you will get
your error message. Otherwise seems to work OK for me.

HTH

"MJRay" wrote:

Hello,

I have the following code to perform a lookup:
mtch = Application.WorksheetFunction.VLookup( _
Worksheets("Nabanco").Cells(nr, 14).Value, _
Worksheets("RDMTemp").Range("A1:T5000"), _
20, False)
The error I get is "Run time error 1004, Unable to get the vlookup property
of the WorksheetFUnction class.

Thanks,
Mike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Vlookup Error

If you drop the .worksheetfunction, you can test for the error:

dim mtch as Variant 'could return an error

mtch = Application.WorksheetFunction.VLookup( _
Worksheets("Nabanco").Cells(nr, 14).Value, _
Worksheets("RDMTemp").Range("A1:T5000"), _
20, False)

if iserror(mtch) then
'it returned an error
else
'no error
end if



MJRay wrote:

Hello,

I have the following code to perform a lookup:
mtch = Application.WorksheetFunction.VLookup( _
Worksheets("Nabanco").Cells(nr, 14).Value, _
Worksheets("RDMTemp").Range("A1:T5000"), _
20, False)
The error I get is "Run time error 1004, Unable to get the vlookup property
of the WorksheetFUnction class.

Thanks,
Mike


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup error wesley holtman Excel Worksheet Functions 0 October 1st 11 08:43 PM
VLOOKUP IS ERROR PAL Excel Worksheet Functions 3 May 7th 10 08:28 AM
vlookup error... Rajmahal Excel Worksheet Functions 3 September 23rd 07 02:32 AM
vlookup error Vlookup not accurate Excel Discussion (Misc queries) 0 October 4th 06 06:21 PM
vlookup error Jim Excel Worksheet Functions 1 January 25th 06 08:49 PM


All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"