I have a report with dates and times in one column expressed as 2024-04-23T08:43:31+09:30
I have code that extracts the required date and time from this mess:
I also have code that determines a start and end date of a period of interest
These lines correctly evaluate to 23/04/2024 and 29/04/2024 respectively
I then need to filter the data according to the start and end dates, but the following line of code returns a blank selection. If I manually filter the data, I can select dates, ignoring the time portion. Why can't the code do the same thing?
I have code that extracts the required date and time from this mess:
VBA Code:
For Each cell In rReportTime
cell = CDate(Left(WorksheetFunction.Substitute(cell.Value, "T", " "), 19))
Next
I also have code that determines a start and end date of a period of interest
VBA Code:
StartReportDate = CDate(Left(PaymentReport.ActiveSheet.Range("A" & Rows.Count).End(xlUp).Value, 10))
EndReportDate = CDate(Left(PaymentReport.ActiveSheet.Range("A2"), 10))
I then need to filter the data according to the start and end dates, but the following line of code returns a blank selection. If I manually filter the data, I can select dates, ignoring the time portion. Why can't the code do the same thing?
VBA Code:
ExpReport.ActiveSheet.Range("A1", Cells(LastRow, LastCol)).AutoFilter Field:=3, Criteria1:=">=" & StartReportDate, Operator:=xlAnd, Criteria2:="<=" & EndReportDate