Using WorksheetFunctions in Excel Macros

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

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?
 
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
 
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
 
Back
Top