Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default filter on date

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default filter on date

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

"Dan" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default filter on date

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)



"Dan" wrote in message
...
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

"Dan" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter latest date from multiple date entries [email protected] Excel Worksheet Functions 1 July 4th 08 09:40 PM
Filter Date mulehead Excel Discussion (Misc queries) 3 September 21st 07 11:56 PM
Dupliate names with different date Filter for newest date Becky Excel Discussion (Misc queries) 1 April 8th 07 08:38 PM
Date Filter?!? Joe Blow Excel Programming 2 May 8th 04 02:49 PM
Date filter using now() Bruce[_5_] Excel Programming 0 September 2nd 03 11:57 PM


All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"