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. |
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. |
All times are GMT +1. The time now is 06:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com