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 ULTIMATE EXCEL SHORTCUTS COURSE
worth $40 for FREE!!

Subscribe to our newsletter and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

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

Huge Discount on the Best ADVANCED EXCEL Course. GET IT NOW!! CLICK HERE!!
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
HOW TO GET MY $40 COURSE FOR FREE
Get My $40 Excel Course For Free!! COUPON CODE Inside!!
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
HOW TO FIND IF A TEXT STRING CONTAINS SPECIFIC TEXT IN EXCEL
How to Find if a Text String Contains Specific Text in Excel
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
How To Change Shape of Comment Box in Excel
How To Change The Shape Of Comment Box In Excel
Excel Dumbest Challenge
Excel Dumb Challenge – Do You Have Time To Waste?

Get my ULTIMATE EXCEL SHORTCUTS COURSE
worth $40 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!"