Is there a way to sort out the sheets into alphabetical order in excel 2010?
Is there a way to sort out the sheets into alphabetical order in excel 2010?
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
[QUOTE=Armando Montes;3006090]Copy this in a module:
What do you mean? A module?
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.
Open the VBA editor Alt+F11
Insert: Module
Paste the code there
Run the macro
Muchas gracias Armando
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks