#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
sorting Curt Excel Discussion (Misc queries) 17 January 3rd 07 10:12 PM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
Sorting SnobbishJade New Users to Excel 6 April 2nd 06 02:08 AM
Sorting Ronnie Excel Discussion (Misc queries) 6 July 19th 05 02:15 AM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"