How to sort Worksheets alphabetically using VBA in Excel

preview_player
Показать описание
In this tutorial you will learn how to sort Worksheets alphabetically using VBA in Microsoft Excel with VBA Macro Programming

VBA Code:

'This code will sort the worksheets alphabetically
Sub ArrangeSheetsAsc()
Application.ScreenUpdating = False
Dim ShCount As Integer, i As Integer, j As Integer
ShCount = Sheets.Count
For i = 1 To ShCount - 1
For j = i + 1 To ShCount
If Sheets(j).Name (less than sign) Sheets(i).Name Then
Sheets(j).Move before:=Sheets(i)
End If
Next j
Next i
Application.ScreenUpdating = True
End Sub
Рекомендации по теме