Autofilter Question

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
 
D

Don Guillett

Selection.AutoFilter Field:=3, Criteria1:=">=1-1-2003", Operator:=xlAnd,
range("yourrange").AutoFilter Field:=3, Criteria1:=">=1-1-2003",
Operator:=xlAnd,
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Apply macro to all worksheets 15
Autofilter in a macro 1
Custom filter 26
Dydnamic date in an autofilter 2
Error Handle problem 4
Help please with autofilter and dates 7
Help me4 2
Automated autofilter error 1

Top