Sorting tabs alphabetically has always been something of a problem in Excel as there isn’t actually a facility for this in the software. However, it can be quite easily achieved with a simple VBA macro. The following script should work in all Excel version from 97 onwards:
Dim i As Integer, j As Integer
For i = 1 To Sheets.Count
For j = 1 To Sheets.Count – 1
If UCase$(Sheets(j).Name) > UCase$(Sheets(j + 1).Name) Then
Sheets(j).Move after:=Sheets(j + 1)
To use the script:
- First enable the Developer tab on the Ribbon. This can be done by clicking File then choosing Options. Select Customise Ribbon and then tick the box marked Developer.
- Next click the Developer tab and then click the Visual Basic tool button.
- Now click Insert on the VBA menu and choose Module.
- Next paste the VBA script into the Module window which will opened.
- Close the VBA window, then click Macros on the Developer tab.
- Finally, select the SortSheets macro the click the Run button. The worksheet tabs will now be arranged alphabetically.