ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting autofilter criteria (https://www.excelbanter.com/excel-programming/301154-setting-autofilter-criteria.html)

peterDavey

Setting autofilter criteria
 
G'day all,
I'm tryung to write some code that will set the value of criterion1 for a
date column in an Excel 97 table. When I recorded this action I got the
following code:

Selection.AutoFilter Field:=3, Criteria1:="01-Jun-04"

and it works OK. If I then run this macro it hides all rows. I suspect
that it might have something to do with date handling. Any suggestions will
be greatly appreciated.

cheers
peterDavey
Austin Health
Melbourne



Frank Kabel

Setting autofilter criteria
 
Hi
not tested but try

Selection.AutoFilter Field:=3, Criteria1:= _
Dateserial(2004,6,1)

-----Original Message-----
G'day all,
I'm tryung to write some code that will set the value of

criterion1 for a
date column in an Excel 97 table. When I recorded this

action I got the
following code:

Selection.AutoFilter Field:=3, Criteria1:="01-Jun-04"

and it works OK. If I then run this macro it hides all

rows. I suspect
that it might have something to do with date handling.

Any suggestions will
be greatly appreciated.

cheers
peterDavey
Austin Health
Melbourne


.



All times are GMT +1. The time now is 05:25 PM.

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