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.
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.
[vba]
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
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber