Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic Sorting and Inserting Rows
I need to sort dates in a single column and group them so that different
dates are separated by an inserted row. Is there a way to do this without performing it manually? Any help would be greatly appreciated! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic Sorting and Inserting Rows
The macro below will work on the active sheet if the dates are in Column A
Sub InsertRows() LastRow = Range("A" & Rows.Count).End(xlUp).Row For RowCount = (LastRow - 1) To 1 Step -1 If Range("A" & RowCount) < Range("A" & (RowCount + 1)) Then Rows(RowCount + 1).Insert End If Next "Andy" wrote: I need to sort dates in a single column and group them so that different dates are separated by an inserted row. Is there a way to do this without performing it manually? Any help would be greatly appreciated! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic Sorting and Inserting Rows
One option is to use DataSubtotal. It will insert a line after each date
group. It has the additional benefit of summing other columns, which you may find useful. If not, have it sum a hidden column. Regards, Fred. "Andy" wrote in message ... I need to sort dates in a single column and group them so that different dates are separated by an inserted row. Is there a way to do this without performing it manually? Any help would be greatly appreciated! |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic Sorting and Inserting Rows
Joel, thanks a lot! Macro works just as I wanted. However, there is an
important detail that I failed to mention. The first four rows of the data I am working with are text titles, meaning that I would not want to separate different rows until the fifth row down. If this macro could work for dates only, or for all rows after the fourth, it would be perfect! Again, I truly appreciate the help- it will make a big difference for everyone at work. Thanks "Joel" wrote: The macro below will work on the active sheet if the dates are in Column A Sub InsertRows() LastRow = Range("A" & Rows.Count).End(xlUp).Row For RowCount = (LastRow - 1) To 1 Step -1 If Range("A" & RowCount) < Range("A" & (RowCount + 1)) Then Rows(RowCount + 1).Insert End If Next "Andy" wrote: I need to sort dates in a single column and group them so that different dates are separated by an inserted row. Is there a way to do this without performing it manually? Any help would be greatly appreciated! |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Automatic Sorting and Inserting Rows
Change this line:
For RowCount = (LastRow - 1) To 1 Step -1 to For RowCount = (LastRow - 1) To 5 Step -1 Regards, Fred. "Andy" wrote in message ... Joel, thanks a lot! Macro works just as I wanted. However, there is an important detail that I failed to mention. The first four rows of the data I am working with are text titles, meaning that I would not want to separate different rows until the fifth row down. If this macro could work for dates only, or for all rows after the fourth, it would be perfect! Again, I truly appreciate the help- it will make a big difference for everyone at work. Thanks "Joel" wrote: The macro below will work on the active sheet if the dates are in Column A Sub InsertRows() LastRow = Range("A" & Rows.Count).End(xlUp).Row For RowCount = (LastRow - 1) To 1 Step -1 If Range("A" & RowCount) < Range("A" & (RowCount + 1)) Then Rows(RowCount + 1).Insert End If Next "Andy" wrote: I need to sort dates in a single column and group them so that different dates are separated by an inserted row. Is there a way to do this without performing it manually? Any help would be greatly appreciated! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting Blank rows after every row upto 2500 rows | Excel Worksheet Functions | |||
Inserting automatic text in Excel | Excel Worksheet Functions | |||
Inserting pictures then sorting | Excel Discussion (Misc queries) | |||
Inserting Automatic Date | Excel Worksheet Functions | |||
Realtime Automatic sorting of data in rows in new work sheet | Excel Worksheet Functions |