Autofilter Question

  • Thread starter Thread starter geen
  • Start date Start date
G

geen

Good day,

I have a workbook with a sheet named 'Download'
On this sheet i want to filter column C
When i record what i want to happen i get the following code :
Sheets("Download").Select
Selection.AutoFilter Field:=3, Criteria1:=">=1-1-2003", Operator:=xlAnd,
Criteria2:="<31-1-2003"
But when i run it, i get nothing selected.
What goes wrong??

Tia Mark
 
Selection.AutoFilter Field:=3, Criteria1:=">=1-1-2003", Operator:=xlAnd,
range("yourrange").AutoFilter Field:=3, Criteria1:=">=1-1-2003",
Operator:=xlAnd,
 
I believe your problem is that you are using d-m-yyyy format and vba works
with the US format

Sheets("Download").Select
Selection.AutoFilter Field:=3, Criteria1:=">=" & cDate("1-1-2003"), _
Operator:=xlAnd, Criteria2:="<" & cDate("31-1-2003")

should work.
 
Back
Top