PDA

View Full Version : Problem with Date Filter between two dates



bhaskar_bkp
04-27-2010, 09:14 PM
:banghead:
I want to filter data between "15 apr 2010" and "26 apr 2010" . All Dates are stored in column B. The below code is generated by excel macro recorder but despite having dates between the specified range nothing is showing when I run the macro. Dates are stored in "dd/mm/yyyy" format. I use Excel 07.
Please help me.

Thanx

:dunno ActiveSheet.Range("$B$5:$O$289").AutoFilter Field:=2, Criteria1:= _
">=15/04/2010", Operator:=xlAnd, Criteria2:="<=26/04/2010"

lucas
04-28-2010, 07:10 AM
This has had 15 views and no reply's. Maybe it would help if you posted an example file. I don't have 2007 so I can't even try it for you for sure.

click go advanced and scroll down till you see the button that says manage attachments.

Bob Phillips
04-28-2010, 07:42 AM
Try



With ActiveSheet.Range("$B$5:$O$289")
.AutoFilter Field:=2, _
Criteria1:=">=" & Format(DateSerial(2010, 4, 15), .Cells(2, 2).NumberFormat), _
Operator:=xlAnd, _
Criteria2:="<=" & Format(DateSerial(2010, 4, 26), .Cells(2, 2).NumberFormat)
End With