View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default SORT COLOR CELLS INEXCEL

For interest purposes, this is the code that I sent.

Sub DoPatternSort()


Dim rRange As Range
Dim lRowStart As Long, lRowEnd As Long, lRow As Long
On Error GoTo ErrorEnd
Application.ScreenUpdating = False
Set rRange = Selection.CurrentRegion
lRowStart = rRange.Row + 1
lRowEnd = rRange.Rows.Count


rRange.Cells(1, 2).EntireColumn.Insert


For lRow = lRowStart To lRowEnd Step 1
rRange.Cells(lRow, 2) = rRange.Cells(lRow, 1).Interior.ColorIndex
Next lRow


rRange.Sort Key1:=rRange.Cells(2, 2), Order1:=xlDescending, _
Key2:=rRange.Cells(2, 3), Order2:=xlAscending, _
Key3:=rRange.Cells(2, 1), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal
rRange.Cells(1, 2).EntireColumn.Delete
ErrorEnd:
Application.ScreenUpdating = True
End Sub


--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"JILANI" wrote in message
...
HI

PLS SHOW HOW TO SORT COLORS IN EXCEL IN DETAIL WAY