MrExcel Publishing
Your One Stop for Excel Tips & Solutions

sorting tabs

Posted by Hance on December 25, 2001 5:34 PM

Anyone know how to sort tabs in any fashion?

Posted by Jacob on December 25, 2001 6:35 PM


This will do the trick

Public Sub sortsheets()

Dim iCount As Integer
Dim i As Integer
Dim j As Integer

On Error Resume Next
iCount = Sheets.Count
For i = 1 To iCount - 1
For j = i + 1 To iCount
If Sheets(j).Name < Sheets(i).Name Then
Sheets(j).Move before:=Sheets(i)
End If
Next j
Next i

End Sub