ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using WorksheetFunctions in Excel Macros (https://www.excelbanter.com/excel-programming/293176-using-worksheetfunctions-excel-macros.html)

Ken[_18_]

Using WorksheetFunctions in Excel Macros
 
I want to use the Excel Worksheet Function Match to find
an entry in a range. When attempting to execute, I get
error code 1004. Unable to get the Match Property of the
Worksheet function class.

ndx = Application.WorksheetFunction.Match(aDate, "AMGN!
Date")

What is not available?

Frank Kabel

Using WorksheetFunctions in Excel Macros
 
Hi
this is probably our second parameter. Is this a defined name?.
the following should work:
ndx = Application.WorksheetFunction.Match(aDate, Range("A1:A100"))
if aDate exists within your range

--
Regards
Frank Kabel
Frankfurt, Germany

Ken wrote:
I want to use the Excel Worksheet Function Match to find
an entry in a range. When attempting to execute, I get
error code 1004. Unable to get the Match Property of the
Worksheet function class.

ndx = Application.WorksheetFunction.Match(aDate, "AMGN!
Date")

What is not available?


Peter Beach

Using WorksheetFunctions in Excel Macros
 
Hi Ken,

Match is expecting the second argument to be a range, but you are giving it
a text string. Try something like:

Sub A()
Dim nIdx As Long
Dim W As Worksheet

Set W = ThisWorkbook.Worksheets(1)
nIdx = Application.WorksheetFunction.Match("c", W.Range("Rng"))
Debug.Print nIdx
End Sub

For the named range Rng.

HTH

Peter Beach

"Ken" wrote in message
...
I want to use the Excel Worksheet Function Match to find
an entry in a range. When attempting to execute, I get
error code 1004. Unable to get the Match Property of the
Worksheet function class.

ndx = Application.WorksheetFunction.Match(aDate, "AMGN!
Date")

What is not available?





All times are GMT +1. The time now is 01:44 PM.

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