Hi, I am using macro to filter list of data and would like to select all records with date less than today. I have used following VBA code to do that:
This is one of few filters I apply, therefore Operator is AND.
I get empty list after running macro, but I can see that filter is applied. I do manually go into filter, it correctly points to Date Filter Before and has todays date. Once I go into filter manually and then go out without doing any changes, suddenly filtering is applied correctly and see the list of data as requested.
Why is my macro failing to achieve required result?
VBA Code:
ActiveSheet.Range("$A$5:$R$1000").AutoFilter Field:=18, Criteria1:="<" & Date, Operator:=xlAnd
This is one of few filters I apply, therefore Operator is AND.
I get empty list after running macro, but I can see that filter is applied. I do manually go into filter, it correctly points to Date Filter Before and has todays date. Once I go into filter manually and then go out without doing any changes, suddenly filtering is applied correctly and see the list of data as requested.
Why is my macro failing to achieve required result?