How to Sort Excel Sheet Tabs Alphabetically
How to sort sheet tabs in Excel A-to-Z or Z-to-A: drag-and-drop, VBA loop, and a free macro that handles 50+ tab workbooks in one click.
2026-04-28
The "tabs are in random order" problem
Tabs in Excel are draggable, which means they end up in whatever order someone last left them. After enough months, that's "no order at all". You want them alphabetical so you can find what you need.
TL;DR — Key takeaways
- Manual drag works for a few tabs but is tedious for 30+.
- A VBA loop can sort tabs alphabetically.
- A free macro does it in one click with A-to-Z or Z-to-A choice.
Method 1: Manual drag
Click a tab, drag to its alphabetical position. Repeat for each tab.
For 38 tabs, expect about 4 minutes of dragging. Two or three tabs end up in the wrong position because you misread the alphabet at speed.
Method 2: VBA loop
Sub SortTabsAlpha()
Dim i As Long, j As Long
Dim n As Long
n = ActiveWorkbook.Worksheets.Count
For i = 1 To n - 1
For j = 1 To n - i
If StrComp(Worksheets(j).Name, Worksheets(j + 1).Name, vbTextCompare) > 0 Then
Worksheets(j + 1).Move Before:=Worksheets(j)
End If
Next j
Next i
End Sub
Drop in a module. Run.
The catch: if you don't already use VBA, the setup is more than the payoff.
Method 3: The free VBA macro
Download Sort Sheets Alphabetically. Free .xlsm with one macro.
- Open the workbook.
- Alt + F8, pick the macro, click Run.
- Type 1 for A-to-Z or 2 for Z-to-A.
- Done in 1-5 seconds depending on tab count.
A common scenario: long-lived workbook tab cleanup
Controller's main consolidation workbook has 38 tabs accumulated over 4 years. Tabs are in the order subsidiaries were acquired, which made sense initially and stopped making sense by year 2.
Run Sort Sheets Alphabetically. 38 tabs reorder in 5 seconds. P&L tabs cluster together. BS tabs cluster. Subsidiary names alphabetical inside each cluster.
Pinning a specific tab to position 1
Pure alphabetical sort moves "Summary" away from position 1. To pin it, rename with a leading character that sorts to the top.
Common picks:
_Summary(underscore sorts before letters in StrComp).0_Summary(digit before letters).! Summary(exclamation sorts early).
After renaming, run the macro. Pinned tab stays at position 1.
Frequently asked questions
Does the sort include hidden sheets?
Yes. Hidden tabs sort along with visible ones. Their underlying order changes but visibility stays as is. To unhide first, Unhide All Sheets.
What sort rule is used?
Case-insensitive lexicographic via StrComp with vbTextCompare. So apple and APPLE sort as equal, and numbers in tab names sort character-by-character (so Tab 10 comes before Tab 2).
How do I get natural numeric sort (Tab 2 before Tab 10)?
Zero-pad the numbers: rename to Tab 02, Tab 10. Then alphabetical sort matches what you'd want numerically.
Will it move my Index tab?
If your Index tab is named Sheet Index, it'll sort to the S section. To pin to position 1, rename with a leading underscore or symbol.
Can I undo it?
Yes, Ctrl/Cmd + Z right after running undoes all tab moves at once.
What to do next
After sorting, List All Sheet Names generates a clickable navigation index. To clean up unused hidden tabs, Delete All Hidden Sheets.