brianfosterblack
Active Member
- Joined
- Nov 1, 2011
- Messages
- 251
I am using this macro to sort my sheets into alphabetical order in my workbook
However I want to still keep my "Master" Sheet as the 1st sheet in the workbook
The "Summary" sheet as the second last sheet and
The "Invoice" sheet as the last sheet.
Is there a way to do this?
VBA Code:
Sub SortWorksheets()
Dim sCount As Integer, i As Integer, j As Integer
Application.ScreenUpdating = False
sCount = Worksheets.Count
If sCount = 1 Then Exit Sub
For i = 1 To sCount - 1
For j = i + 1 To sCount
If Worksheets(j).Name < Worksheets(i).Name Then
Worksheets(j).Move Before:=Worksheets(i)
End If
Next j
Next i
Application.ScreenUpdating = True
End Sub
The "Summary" sheet as the second last sheet and
The "Invoice" sheet as the last sheet.
Is there a way to do this?