Sorting by Font Stlye "Bold"


Posted by Mike on February 13, 2002 11:23 AM

I have a rather long list of names in a column. Some of them are bold, and some are not. Is their a way to sort on the names that are bold?

Posted by Tom Urtis on February 13, 2002 2:44 PM

If your names are in column A, starting in A2, then this code will sort them by putting the bold names at the top, then the un-bold at the bottom.

Modify this code if you have data in column B, or if your names are in a different column than A.

Sub SortBold()
Application.ScreenUpdating = False
Dim Rng As Range
Dim Bld As Range
Set Rng = Range([A2], [A65536].End(xlUp))
Rng.Select
For Each Bld In Selection
Bld.Cells(1, 2) = Bld.Cells.Font.Bold
Next
Range(Rng, [B65536].End(xlUp)).Sort _
Key1:=Range("B2"), Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Rng.Offset(, 1).ClearContents
Range("A1").Select
Application.ScreenUpdating = True
End Sub

HTH

Tom Urtis



Posted by Mike on February 14, 2002 6:18 AM

Thank you Tom.