An internet search for "sort excel worksheets' turns up several sites
offering solutioins. One of those is the Ozgrid site, a good source, which
published this code:
Sub SortSheets()
Dim lCount As Long, lCounted As Long
Dim lShtLast As Long
Dim lReply As Long
lReply = MsgBox("To sort Worksheets ascending, select 'Yes'. " _
& "To sort Worksheets descending select 'No'", vbYesNoCancel, "Ozgrid Sheet
Sort")
If lReply = vbCancel Then Exit Sub
lShtLast = Sheets.Count
If lReply = vbYes Then 'Sort ascending
For lCount = 1 To lShtLast
For lCount2 = lCount To lShtLast
If UCase(Sheets(lCount2).Name) < UCase(Sheets(lCount).Name)
Then
Sheets(lCount2).Move Before:=Sheets(lCount)
End If
Next lCount2
Next lCount
Else 'Sort descending
For lCount = 1 To lShtLast
For lCount2 = lCount To lShtLast
If UCase(Sheets(lCount2).Name) > UCase(Sheets(lCount).Name)
Then
Sheets(lCount2).Move Before:=Sheets(lCount)
End If
Next lCount2
Next lCount
End If
End Sub
To put the code into your workbook, press [Alt]+[F11] to enter the VB Editor
and then choose Insert | Module and copy and paste the code above into the
module presented to you, close the VB Editor and run the code from Tools |
Macro | Macros.
Chip Pearson also has a good solution (one I've borrowed myself in the past)
at his site on this page:
http://www.cpearson.com/Excel/sortws.aspx