VBA - Unable to get the Match property of the WorksheetFunction Class

By apalix ·
A previous match statement works perfectly in VBA, using the same sheets while this one does not.

This is the statement:
tmpCol = Application.WorksheetFunction _
.Match(Worksheets("Talk Schedule").Cells(target.Row, target.Column - 2).Value, _
Worksheets("Elders - Servants").Range("A8:BR8"), 0)

I'm matching the date found in the "talk Schedule" with the date in the "Elders - Servants" range.

I converted the statement and used it directly on the Excel sheet and it worked perfectly. I then substituted a range statement in VBA for the cells(), giving it the exact .range("C90")in this case, and still got the error, even though both values are there and are equal.

It seems to be the second value in the match statement that is causing the problem, since printing the first value in the immediate window gives the proper value. Printing the second value by substituting the actual .range("K8"), gives the same value as the first. Yet I still get the error. The match cells are formatted differently, with a "mmm-dd", and a "dd" setup, but setting them to the same date format did not work.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums