Hi,
Can anybody please help me edit my clumsy coding please? I am trying to apply a filter that selects any date apart from dates within the last month. So if I use today for an example the filter will filter for all dates before and including 30/10/2018 because today's date is 30/11/2018. So far I have just been using 30 because that is the easiest option.
Thanks,
Milos
Can anybody please help me edit my clumsy coding please? I am trying to apply a filter that selects any date apart from dates within the last month. So if I use today for an example the filter will filter for all dates before and including 30/10/2018 because today's date is 30/11/2018. So far I have just been using 30 because that is the easiest option.
Code:
Sub Filter_Dates()
Dim date_all As Long
Dim date_month As Long
date_all = DateSerial(Year(Date), Month(Date), Day(Date)) - 1000
date_month = DateSerial(Year(Date), Month(Date), Day(Date)) - 30
ActiveSheet.Rows(2).AutoFilter
ActiveSheet.Rows(2).AutoFilter Field:=3, Criteria1:=">=" & date_all, Operator:=xlAnd, Criteria2:="<=" & date_month
End Sub
End Sub
Thanks,
Milos