How to sort tabs in order of CodeName
Looks like I found some code that will do this. In case anyone is
interested....
Sub SortSheetsCodeName()
Application.ScreenUpdating = False
Dim iSheets%, i%, j%, ws As Worksheet
iSheets = Sheets.Count
For Each ws In Worksheets
If Len(ws.CodeName) = 6 Then
For i = 1 To iSheets - 1
For j = i + 1 To iSheets
If Val(Right(Sheets(j).CodeName, 1)) <
Val(Right(Sheets(i).CodeName, 1)) _
Then Sheets(j).Move befo=Sheets(i)
Next j
Next i
End If
Next ws
For Each ws In Worksheets
If Len(ws.CodeName) 6 Then
For i = 1 To iSheets - 1
For j = i + 1 To iSheets
If Val(Right(Sheets(j).CodeName, 2)) < Val(Right(Sheets(i).CodeName,
2)) _
Then Sheets(j).Move befo=Sheets(i)
Next j
Next i
End If
Next ws
Application.ScreenUpdating = True
End Sub
|