Results 1 to 3 of 3

Thread: Sort Sheets in ascending order

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,302
    Location
    Try this...

    Sub SortWorksheets()
    Dim sCount As Integer, i As Integer, j As Integer
    Application.ScreenUpdating = False
    sCount = Worksheets.Count
    If sCount = 1 Then Exit Sub
    For i = 1 To sCount - 1
        For j = i + 1 To sCount
            If Int(Worksheets(j).Name) < Int(Worksheets(i).Name) Then
                Worksheets(j).Move Before:=Worksheets(i)
            End If
       Next j
    Next i
    Application.ScreenUpdating = True
    End Sub

    Hope this helps
    Last edited by Aussiebear; 04-25-2023 at 09:50 PM. Reason: Adjusted the code tags
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Posting Permissions

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