View Full Version : sort worksheets by tabcolor

02-13-2008, 07:18 AM
I have a workbook withabout 100 sheets for which I would like to sort by tab color if possible. There are 5 colors I use to differentiate them.

Bob Phillips
02-13-2008, 08:58 AM
Public Sub Test()
Dim i As Long

With ActiveWorkbook

For i = 1 To .Worksheets.Count - 1

If .Worksheets(i).Tab.ColorIndex > .Worksheets(i + 1).Tab.ColorIndex Then

.Worksheets(i + 1).Move before:=.Worksheets(i)
i = 0
End If
Next i
End With

End Sub