Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Filtering TIME/DATE

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Filtering TIME/DATE

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Filtering TIME/DATE

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Filtering TIME/DATE

Sorry still won't work!

However I recorded what happened when I clicked on a cell:

ActiveCell.FormulaR1C1 = "11/3/2005 1:35"

Which is as you quite rightly stated m/d/yyyy

I changed the vba to suit but it still doesn't work!


--
Mark


"Tom Ogilvy" wrote:

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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Filtering TIME/DATE

Maybe...

Selection.AutoFilter
Selection.AutoFilter Field:=12, _
Criteria1:="=" & dateserial(2005,11,3) + timeserial(7,0,0), _
Operator:=xlAnd, _
Criteria2:="<=" & dateserial(2005,11,4) + timeserial(6,59,0)





Mark wrote:

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





--

Dave Peterson
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
Converting text format of time/date into Excel time/date for subtr YY san.[_2_] Excel Worksheet Functions 6 February 25th 10 08:27 AM
filtering time nader Excel Worksheet Functions 3 June 26th 08 01:57 PM
Filtering Time Cards ExcelMS Excel Worksheet Functions 0 May 31st 08 03:22 PM
Filtering Time ranges MP Excel Discussion (Misc queries) 1 June 4th 07 04:38 PM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 PM


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

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

About Us

"It's about Microsoft Excel"