+ Reply to Thread
Results 1 to 6 of 6

How to sort sheets into alphabetical order?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    13

    How to sort sheets into alphabetical order?

    Is there a way to sort out the sheets into alphabetical order in excel 2010?

  2. #2
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Mexico
    Posts
    200

    Re: How to sort sheets into alphabetical order?

    Copy this in a module:
    Sub SortABC()
    Dim i As Integer, j As Integer, x As Integer
    x = Sheets.Count
    For i = 1 To x - 1
        For j = i + 1 To x
            If Sheets(j).Name < Sheets(i).Name Then
            Sheets(j).Move before:=Sheets(i)
            End If
        Next
    Next
    Sheets(1).Select
    End Sub

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to sort sheets into alphabetical order?

    [QUOTE=Armando Montes;3006090]Copy this in a module:
    What do you mean? A module?

  4. #4
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Atlanta, USA
    MS-Off Ver
    Office 2003, 2010
    Posts
    230

    Re: How to sort sheets into alphabetical order?

    Try:

    Sub AscSortedSheets()
    
    Dim sh As Worksheet
    Dim a As Integer, i As Integer
    a = Worksheets.Count
    ReDim mymatrice(a)
    
    For Each sh In Sheets
    i = i + 1
    mymatrice(i) = sh.Name
    Next sh
    For Each sh In Sheets
    For i = 1 To UBound(mymatrice)
    If sh.Name < mymatrice(i) Then
    If Sheets(sh.Name).Index > Sheets(mymatrice(i)).Index Then
    Sheets(sh.Name).Move before:=Sheets(mymatrice(i))
    End If
    End If
    Next i
    Next sh
    End Sub

    Edit: Armando's is a bit more concise...
    Last edited by jake.masters; 11-13-2012 at 11:57 AM.

  5. #5
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Mexico
    Posts
    200

    Re: How to sort sheets into alphabetical order?

    Open the VBA editor Alt+F11
    Insert: Module
    Paste the code there
    Run the macro

  6. #6
    Registered User
    Join Date
    11-12-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to sort sheets into alphabetical order?

    Muchas gracias Armando

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1