ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter Question (https://www.excelbanter.com/excel-programming/277903-autofilter-question.html)

geen

Autofilter Question
 
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



Don Guillett[_4_]

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

Operator:=xlAnd,

"geen" wrote in message news:1064433326.443335@cache2...
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





Tom Ogilvy

Autofilter Question
 
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.

--
Regards,
Tom Ogilvy




"geen" wrote in message news:1064433326.443335@cache2...
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






All times are GMT +1. The time now is 07:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com