View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Cann't use "Match" function inside VBA

Saurabh,

You need to pass an actual range to the Match function, not a address
string. Change your formula to

On Error Resume Next
Position = Application.WorksheetFunction.Match(54.2, Range("N2:N100"), 1)
If Err.Number = 0 Then
' match found
Else
' match not found
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com



"Saurabh" wrote in message
m...
I wanted to use the 'Match' function in Excel inside my VBA
Application. I cann't seem to achieve this.

The code is as follows : -



Position = Application.WorksheetFunction.Match(54.2, "N2:N100", 1)

<<


Upon execution, the application gives me the error message : -

"Unable to get the Match property of the WorksheetFunction class"

I have tried various suggestions like installing Analysis Pak addin
and creating a reference to atpvbaen.xls file, but none seem to work.

Please advise me urgently as the project is in its cruicial stage.

Thanks

Saurabh