ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sort date/time (https://www.excelbanter.com/excel-programming/360249-sort-date-time.html)

srroduin

sort date/time
 
I have the following code which worked great when I was sorting only
dates....but it won't sort if I have date and time, 04/02/2006 11:00 format.
What do I have to do differently?

Selection.Sort Key1:=Range("B10"), key2:=Range("N10"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Tom Ogilvy

sort date/time
 
If the times and dates are in column B, then it is highly likely that you
won't have duplicte times and column N will have little influence on the
sort.

That said, I didn't see any difference in the sort whether it was formatted
to show times or not show times as long as the times were still stored in the
cells.

--
Regards,
Tom Ogilvy


"srroduin" wrote:

I have the following code which worked great when I was sorting only
dates....but it won't sort if I have date and time, 04/02/2006 11:00 format.
What do I have to do differently?

Selection.Sort Key1:=Range("B10"), key2:=Range("N10"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal



All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com