Sheet sorting

Contents

If the number of sheets in your book approaches a few dozen, then – sooner or later – there will be a desire to sort the sheets, putting them in order for ease of navigation. Standard Excel tools do not allow you to do this, but you can use a simple macro that implements this sort.

Open the Visual Basic Editor with the keyboard shortcut ALT+F11, insert a new module (menu Insert – Module) and copy the code of this macro there:

Sub SortSheets()      Dim I As Integer, J As Integer        For I = 1 To Sheets.Count - 1          For J = I + 1 To Sheets.Count              If UCase(Sheets(I).Name) > UCase(Sheets(J).Name) Then                  Sheets(J).Move Before:=Sheets(I)              End If          Next J      Next I  End Sub   

Now this macro can be run through the menu Service – Macro – Macros (Tools — Macro — Macros) or by pressing the key combination ALT+F8 and selecting the command Run (run) it will quickly sort all the sheets in the current workbook in ascending order.

  • Quickly move between sheets in an Excel workbook
  • What are macros, where to insert macro code, how to use them
  • Convenient sheet management with List Manager from the PLEX add-on

 

Leave a Reply