I am trying to use the MATCH function in VBA to search for a particular date in a range containing dates and return the matching row number. I can accomplish this in the Excel worksheet but get errors when implementing it in Excel ("type mismatch" I think.)
Several posts have alluded to Application.WorksheetFunction.Match not working properly in VBA when used with dates. Is this in fact true, or is there a workaround? I get the impression that the problem might be whether the dates are seen as unformated (eg. 38675) or formated (1/5/2002). Is there a way to make sure VBA sees both the lookup data and the date range in the same way?
I currently have to perform the calculation in some scratch cells and read back the result into VBA. But it would be cleaner to understand if it can be performed in VBA itself.
Thanks, and aplogies if this has been resolved earlier.
Several posts have alluded to Application.WorksheetFunction.Match not working properly in VBA when used with dates. Is this in fact true, or is there a workaround? I get the impression that the problem might be whether the dates are seen as unformated (eg. 38675) or formated (1/5/2002). Is there a way to make sure VBA sees both the lookup data and the date range in the same way?
I currently have to perform the calculation in some scratch cells and read back the result into VBA. But it would be cleaner to understand if it can be performed in VBA itself.
Thanks, and aplogies if this has been resolved earlier.