The following code does work by placing SUMMARY, MASTER, & INSTRUCTIONS in the right and sorting remaining sheets alphabetically.
However, how do I modify the following code to sort the worksheets so the SUMMARY sheet is first (on left) and MASTER sheet followed by INSTRUCTIONS are the last two sheets on the right? Sorting the remaining sheets alphabetically inbetween SUMMARY and MASTER sheets.
I've tried several changes and can't get it to work as desired.
Sub SortALLSheets()
'sort sheets within a workbook in Excel
Dim iSheet As Long, iBefore As Long
WksName = "SUMMARY"
WksName = "MASTER"
WksName = "INSTRUCTIONS"
For iSheet = 1 To ActiveWorkbook.Sheets.Count
Sheets(iSheet).Visible = True
For iBefore = 1 To iSheet - 1
If Sheets(iBefore).Name <> Sheets(iSheet).Name Then
ActiveWorkbook.Sheets(iSheet).Move Before:=ActiveWorkbook.Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub
However, how do I modify the following code to sort the worksheets so the SUMMARY sheet is first (on left) and MASTER sheet followed by INSTRUCTIONS are the last two sheets on the right? Sorting the remaining sheets alphabetically inbetween SUMMARY and MASTER sheets.
I've tried several changes and can't get it to work as desired.
Sub SortALLSheets()
'sort sheets within a workbook in Excel
Dim iSheet As Long, iBefore As Long
WksName = "SUMMARY"
WksName = "MASTER"
WksName = "INSTRUCTIONS"
For iSheet = 1 To ActiveWorkbook.Sheets.Count
Sheets(iSheet).Visible = True
For iBefore = 1 To iSheet - 1
If Sheets(iBefore).Name <> Sheets(iSheet).Name Then
ActiveWorkbook.Sheets(iSheet).Move Before:=ActiveWorkbook.Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub