Macro to Sort worksheets


Sort worksheets in Alphabetical (Ascending) order of sheet names


Sub SortWorksheetsAtoZ()
Dim a As Long, b As Long, c As Long
Application.ScreenUpdating = False
With ActiveWorkbook
c = .Worksheets.Count
If c > 1 Then
For a = 2 To c
For b = 2 To c
If .Worksheets(b).Name < .Worksheets(b - 1).Name Then .Worksheets(b).Move before:=.Worksheets(b - 1)
Next
Next
End If
End With
End Sub

Sort worksheets in Reverse Alphabetical (Descending) order of sheet names


Sub SortWorksheetsZtoA()
Dim a As Long, b As Long, c As Long
Application.ScreenUpdating = False
With ActiveWorkbook
c = .Worksheets.Count
If c > 1 Then
For a = 2 To c
For b = 2 To c
If .Worksheets(b).Name > .Worksheets(b - 1).Name Then .Worksheets(b).Move before:=.Worksheets(b - 1)
Next
Next
End If
End With
End Sub

How to use codes shared here?