filter on date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to filter on a date.

Range("C8").AutoFilter Field:=3, Criteria1:=">=10/08/2007 00:00",
Operator :=xlAnd, Criteria2:="<=13/08/2007 24:00"

( I got that from recoding a macro)

but that does not work from the code - some filtering is done but I get a
blank table (when I was reording the macro I was getting the correct results).

Any Idea? thanks

Dan
 
I have found the reason (but still do not know how to solve it)

For some reason excel convert all my date to american format so 10/08/2007
become 008/10/2007 and therefor there is no result.

All my setting are UK settings?

Any idea
 
Darn US dates <g>

Dim date1_value As Date
Dim date2_value As Date


Sheets("Detail").Select
date1_value = DateValue("10-Aug-2007")
date2_value = DateValue("13-Aug-2007")
Range("C8").AutoFilter Field:=1, _
Criteria1:=">=" & Str(CDbl(date1_value)), _
Operator:=xlAnd, _
Criteria2:="<=" & Str(CDbl(date2_value))


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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


Back
Top