Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sorting
I have a list in alphabetical order on an excel sheet.
I have a separate paragraph for each letter separated by a line. E.g Bob Boris Carl Catherine How can I sort both the entire sheet and within the paragraphs together rather than sorting each paragraph individually. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sorting
I would use a macro. Delete blank row, sort, then add blank row back
Sub sort() 'delete blank rows LastRow = Range("A" & Rows.Count).End(xlUp).Row For RowCount = LastRow To 1 Step -1 If Range("A" & RowCount) = "" Then Rows(RowCount).Delete End If Next 'now sort LastRow = Range("A" & Rows.Count).End(xlUp).Row Set sortrange = Rows("1:" & LastRow) sortrange.sort _ Key1:=Range("A4"), _ Order1:=xlAscending, _ Header:=xlGuess 'add blank row back 'delete blank rows RowCount = 1 Do While Range("A" & RowCount) < "" If Left(Range("A" & RowCount), 1) < _ Left(Range("A" & (RowCount + 1)), 1) Then Rows(RowCount + 1).Insert RowCount = RowCount + 1 End If RowCount = RowCount + 1 Loop End Sub "NaidyLady" wrote: I have a list in alphabetical order on an excel sheet. I have a separate paragraph for each letter separated by a line. E.g Bob Boris Carl Catherine How can I sort both the entire sheet and within the paragraphs together rather than sorting each paragraph individually. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sorting VLookup vs Sorting SumProduct | Excel Discussion (Misc queries) | |||
sorting | Excel Discussion (Misc queries) | |||
Sorting: Sorting by the First Character | Excel Discussion (Misc queries) | |||
Sorting | New Users to Excel | |||
Sorting | Excel Discussion (Misc queries) |