ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cann't use "Match" function inside VBA (https://www.excelbanter.com/excel-programming/276023-re-cannt-use-match-function-inside-vba.html)

Chip Pearson

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





All times are GMT +1. The time now is 03:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com