Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheetfunction MATCH
Hi,
When I try the following I always get Run-time Error '1004': Unable to get the Match property of the WorksheetFunction class Workbooks.Open Filename:=filenaam, ReadOnly:=True myVar = Application.WorksheetFunction.Match(9, Worksheets(1).Range("A1:A10"), 0) MsgBox myVar What is the fault, I don't really see it. Thanks a lot in advance, Yves |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheetfunction MATCH
Is there a 9 in Range A1:A10?
If not, then Match raises an error such as you describe. Sub tester1() On Error Resume Next myvar = Empty myvar = Application.WorksheetFunction.Match(9, _ Worksheets(1).Range("A1:A10"), 0) On Error GoTo 0 If myvar < Empty Then MsgBox myvar Else MsgBox "Not found" End If End Sub Might be an approach you can use. -- Regards, Tom Ogilvy "Yves Janssens" wrote in message .be... Hi, When I try the following I always get Run-time Error '1004': Unable to get the Match property of the WorksheetFunction class Workbooks.Open Filename:=filenaam, ReadOnly:=True myVar = Application.WorksheetFunction.Match(9, Worksheets(1).Range("A1:A10"), 0) MsgBox myVar What is the fault, I don't really see it. Thanks a lot in advance, Yves |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheetfunction MATCH
Tom,
Thanks a lot. There indeed is no value 9 in that range. But, I never thaught it would generate this error. Thanks a lot, Yves "Tom Ogilvy" wrote in message ... Is there a 9 in Range A1:A10? If not, then Match raises an error such as you describe. Sub tester1() On Error Resume Next myvar = Empty myvar = Application.WorksheetFunction.Match(9, _ Worksheets(1).Range("A1:A10"), 0) On Error GoTo 0 If myvar < Empty Then MsgBox myvar Else MsgBox "Not found" End If End Sub Might be an approach you can use. -- Regards, Tom Ogilvy "Yves Janssens" wrote in message .be... Hi, When I try the following I always get Run-time Error '1004': Unable to get the Match property of the WorksheetFunction class Workbooks.Open Filename:=filenaam, ReadOnly:=True myVar = Application.WorksheetFunction.Match(9, Worksheets(1).Range("A1:A10"), 0) MsgBox myVar What is the fault, I don't really see it. Thanks a lot in advance, Yves |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
WorksheetFunction.Vlookup | Excel Discussion (Misc queries) | |||
WorksheetFunction help | Excel Discussion (Misc queries) | |||
Can't use WorksheetFunction | Excel Discussion (Misc queries) | |||
WorksheetFunction with VBA | Excel Discussion (Misc queries) | |||
Application.WorksheetFunction.Match problem | Excel Worksheet Functions |