Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting text format of time/date into Excel time/date for subtr | Excel Worksheet Functions | |||
filtering time | Excel Worksheet Functions | |||
Filtering Time Cards | Excel Worksheet Functions | |||
Filtering Time ranges | Excel Discussion (Misc queries) | |||
Calculating days & time left from start date/time to end date/time | Excel Worksheet Functions |