Hi Team,
I want to filter date Column. faced lot of challenges in filtering date.
Finally got below code which works.
Can you share Any other ways of filtering date Column.
Below is the one solution working for me .
Below is my Input Column... where needs to apply filter.
Thanks
mg
I want to filter date Column. faced lot of challenges in filtering date.
Finally got below code which works.
Can you share Any other ways of filtering date Column.
Below is the one solution working for me .
VBA Code:
Sub DateFilter()
Dim startDate As Long
Dim endDate As Long
startDate = CLng(DateValue("01/01/2018")) 'Criteria to filter start date
endDate = CLng(DateValue("31/12/2019")) 'Criteria to Filter endDate
With Range("a1").CurrentRegion
.AutoFilter Field:=1, Criteria1:=">=" & startDate, Operator:=xlAnd, Criteria2:="<=" & endDate
End With
End Sub
Below is my Input Column... where needs to apply filter.
Book6 | |||
---|---|---|---|
A | |||
1 | Invoice Date | ||
2 | 01/01/2018 | ||
3 | 01/01/2018 | ||
4 | 31/12/2018 | ||
5 | 31/12/2018 | ||
6 | 31/12/2018 | ||
7 | 05/08/2019 | ||
8 | 05/08/2019 | ||
9 | 27/09/2019 | ||
10 | 14/12/2019 | ||
11 | 11/01/2020 | ||
12 | 11/01/2020 | ||
13 | 11/01/2020 | ||
14 | 11/01/2020 | ||
15 | 11/01/2020 | ||
16 | 11/01/2020 | ||
Sheet1 |
Thanks
mg