excel+vba+training - arranging sheets alphabetically

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

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

excel+vba+training - Arranging sheets alphabetically

resolvedResolved · Low Priority · Version 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


 

Excel tip:

Hiding and unhiding columns using the keyboard

CTRL + 0 hides your columns and CTRL + SHIFT + ) unhides them although you would need to highlight the column letters either side as per normal

View all Excel hints and tips


Server loaded in 0.08 secs.