View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Filtering TIME/DATE

but in VBA it should be mm/dd/yyyy. Try that and see if your filter doesn't
work.

Selection.AutoFilter
Selection.AutoFilter Field:=12, Criteria1:="=11/03/2005 07:00", _
Operator:=xlAnd, Criteria2:="<=11/04/2005 06:59"

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
I have already done that to see what is reproduced in VBA and here's what

it
is recorded:

Selection.AutoFilter
Selection.AutoFilter Field:=12, Criteria1:="=03/11/2005 07:00",
Operator _
:=xlAnd, Criteria2:="<=04/11/2005 06:59"

The spreadsheet format is different to what is recorded, the date format

on
the spreadsheet should be dd/mm/yyyy.

--
Mark


"Tom Ogilvy" wrote:

for a start, turn on the macro recorder and apply your filter.

See how it records the criteria.

Also, your dates are ambiguous - are the mm/dd/yy or dd/mm/yy. VBA is
looking for mm/dd/yy

--
Regards,
Tom Ogilvy

"Mark" wrote in message
...
I am using excel 97. I am trying to filter a worksheet of data which
contains a column of a time/date in this format: 02:05 03/11/05

I want to be able to create a custom filter in VBA of: = 07:00

03/11/05
or
<= 0659 04/11/05 but for some reason when I do it will not work. The
formatting of the column is 'GENERAL', however as a matter if interest

when a
cell of this type is clicked on the format changes to 'CUSTOM'

dd/mm/yyyy
hh:mm

Can someone come up with code as a solution for me, please?

--
Mark