Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel+vba+training - arranging sheets alphabetically

Forum home » Delegate support and help forum » Microsoft Excel Training and help » excel+vba+training - Arranging sheets alphabetically

excel+vba+training - Arranging sheets alphabetically

ResolvedVersion Standard

Heidi Doan has attended:
Word Advanced course
Excel Advanced course
Access Introduction course
Outlook Advanced course

Arranging sheets alphabetically

Hi, how do I arrange all the sheets in a workbook alphabetically? Thanks.

RE: Arranging sheets alphabetically

Heidi

Excel doesn't provide a feature that sorts a workbook's sheets alphabetically by sheet name.

However, you can use the simple procedure below. To do this:

1. Press Alt + F8 to display Excel's Macro dialog box

2. In the Macro Name window type in AlphaSheet (Or any other macro name you wish)

3. Click the Create button

The Visual Basic Editor appears, open at a new module sheet already containing the beginning and ending statements in the procedure.

Fill in the rest of the code or copy the middle part of the procedure below and paste it into the code window so as to complete the procedure

Sub AlphaSheet()

Dim Count As Integer
Dim i As Integer
Dim j As Integer

Application.ScreenUpdating = False

Count = Sheets.Count

For i = 1 To Count - 1
For j = i + 1 To Count
If Sheets(j).Name < Sheets(i).Name Then
Sheets(j).Move Before:=Sheets(i)
End If
Next
Next

End Sub


Close the Visual Basic Editor and return to Excel. To run the procedure:

1. Press Alt + F8 to display Excel's Macro dialog box

2. Choose AlphaSheet from the list of macro names

3. Click OK.

This will arrange the sheets alphabetically.

Carlos

 

Training courses

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.