I'm trying to find a row by a given date. This works all right with the worksheet function MATCH, but when I try to do the same in VBA, I get an error. I boiled the problem down to the following:
[vba]Sub FindDateTime()
Dim dt As Variant ' Ideally, this should be DateTime, but that's not allowed here.
Range("A1") = Now ' Write date/time in the sheet.
dt = Range("A1") ' Retrieve same date/time.
Debug.Print dt ' Check if it looks OK.
Debug.Print WorksheetFunction.Match(dt, Range("A:A"), 0) ' Find same date/time in same column.
End Sub
[/vba] This gives me the errorIt doesn't seem to be a rounding error; I tried that with a series of date/times and used match_type 1, but to no avail.Run-time error 1004
Unable to get the match property of the WorksheetFunction class.
I'm using Office XP on Windows XP.