How to Sort Excel Worksheets in Alphabetical Order

Published on March 1, 2017
image_pdfimage_print

Sorting Excel Worksheets in Alphabetical Order

Suppose you are working on an Excel Workbook having numerous worksheets (For example an excel workbook having multiple worksheets named as per names of all the employees).

Now, you want to arrange all those worksheets in Alphabetical Order.

Doing this manually can take a lot of time. But this can be done with just a few clicks if you use Excel VBA.

The steps are given below.

  1. Open the worksheet and press Alt + F11 to open the Visual Basic Editor.

2. Go to Insert menu and click ‘Module’. A new module will be inserted. Here you can enter the VBA code.

3. Copy the following code and paste it in the code box.

Sub SortSheetbyName()
       Dim numberOfSheets As Integer
       Dim sheetPosition As Integer
       Dim I As Integer
       numberOfSheets = ActiveWorkbook.Worksheets.Count
       sheetPosition = numberOfSheets
       Do
           If sheetPosition = 1 Then Exit Do

           For I = 1 To sheetPosition – 1
                If Sheets(I).Name > Sheets(I + 1).Name Then
                    Sheets(I + 1).Move before:=Sheets(I)
               End If
           Next I

sheetPosition = sheetPosition – 1
       Loop
End Sub

4. Press F5 to run the macro. All the sheets will be arranged in alphabetical order.

Cool, isn’t it? Hope you found this short post useful. If you want to get our posts in your email, please subscribe to our newsletter by filling the form below (and also get my course worth $25 for free).

GET MY EXCEL GUIDE FOR FREE
COMPLETE EXCEL FUNCTIONS AND SHORTCUTS GUIDE

Subscribe to our newsletter and get my Complete Excel Functions and Shortcuts Guide for FREE!

Thank you for subscribing.

Something went wrong.

See you soon with another such useful article. Happy Excelling!!

HUGE LIMITED TIME DISCOUNT ON THE BEST ADVANCED EXCEL COURSE ENROLL NOW!!
excel_look_professional
Making Excel Worksheets Look Professional – A Case Study
14 Excel tips
14 Excel Tips – Make Yourself Super-Efficient in Excel
DATA CLEANING EXCEL
Ultimate Guide to Data Cleaning in Excel – 11 Super-Powerful Data Cleaning Techniques
RANDOMIZE LIST RANDBETWEEN
Randomize a List in Excel Using RANDBETWEEN Function
FREEZE PANES
Freeze Panes in Excel – The Complete Guide
HOW TO LEARN EXCEL
How to Learn Excel and Be a Spreadsheet Champion
BEST BOOKS COURSES EXCEL VBA
Best Books and Courses to Learn Excel VBA
BECOME AN EXCEL NINJA COMPLETE REVIEW
Become An Excel Ninja – Course Review
BEST EXCEL COURSES
10 Best Online Courses to Make You an Excel Wizard
BEST BOOKS COURSES EXCEL VBA
Best Books and Courses to Learn Excel VBA
How to Sort Excel Worksheet in Alphabetical Order
How to Sort Excel Worksheets in Alphabetical Order
VBAPOST1
How to Add And Name A New Sheet At The Same Time Using Excel VBA
ROUNDING NUMBERS IN EXCEL
Rounding Numbers in Excel – The Complete Guide
number_of_words
How to Find the Number of Words in a Text String in Excel
HOW TO FIND IF A TEXT STRING CONTAINS SPECIFIC TEXT IN EXCEL
How to Find if a Text String Contains Specific Text in Excel
How To Indentify ULP case in a text string
How To Identify If A Text String Is In Upper, Lower Or Proper Case
Pivot Tables
How To Convert Pivot Table Into Frequency Distribution
How to Convert Pivot Table into a Frequency Distribution in Excel

GET MY EXCEL GUIDE FOR FREE
COMPLETE EXCEL FUNCTIONS AND SHORTCUTS GUIDE

Subscribe to our newsletter and get my Complete Excel Functions and Shortcuts Guide for FREE!

Thank you for subscribing.

Something went wrong.

Share
Tweet
+1
Pin
Share
Stumble
Enjoyed this video?
How to Sort Excel Worksheet in Alphabetical Order
"No Thanks. Please Close This Box!"