View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
R NG[_2_] R NG[_2_] is offline
external usenet poster
 
Posts: 1
Default AutoFilter Issue

Hello all,

I have a table with the second column being a date field. I use the macro
recorder to record my autofilter action:
1. Select the headings (A4:E4) of the table;
2. Apply autofiltering;
3. On the second column (the date field), set the criteria to be "on or
after 01.08.2009"
and came up with the following code:

Range("A4:E4").Select
Selection.AutoFilter
ActiveSheet.Range("$A$4:$E$9").AutoFilter Field:=2, Criteria1:= _
"=01.08.2009", Operator:=xlAnd

Things work fine (i.e. only records on or after 01.08.2009 are displayed)
while I was recording, but when I "unfilter" and then run the above code,
all records are filtered out. Nothing left.

This same issue occurs while using either Excel XP or Excel 07 in
compatibility mode.
Then I recorded another macro for autofiltering a text field, the macro
works fine, so it seems the problem has something to do with the date. I
tried tinkering with the code somewhat, but no luck. What can I do now?

Suggestions are most welcome. (I use Win XP)