View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Yves Janssens Yves Janssens is offline
external usenet poster
 
Posts: 4
Default 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