chriscorpion786
New Member
Hello ALL,
I have a macro that filters dates by month and year based on cell values. I have dates that range from the year 2020 till year 2030.
Now the strange part is that all years filter properly except for any dates that lie within the year 2030
I have the below code and could'nt find a solution as to why 2030 dates are not filtering.
>>> use code - tags <<<
I have a macro that filters dates by month and year based on cell values. I have dates that range from the year 2020 till year 2030.
Now the strange part is that all years filter properly except for any dates that lie within the year 2030
I have the below code and could'nt find a solution as to why 2030 dates are not filtering.
>>> use code - tags <<<
Code:
Dim startdt As Range
Dim enddt As Range
Set startdt = ThisWorkbook.Sheets("Controls").Range("J2")' e.g format is 01-05-2030
Set enddt = ThisWorkbook.Sheets("Controls").Range("L2")e.g format is 31-05-2030
ThisWorkbook.Sheets("Tasks").Range("A1").AutoFilter Field:=1, Criteria1:=">=" & startdt, Operator:=xlAnd, Criteria2:="<" & enddt
Last edited by a moderator: