Consulting

Results 1 to 3 of 3

Thread: Sorting Sheets in a specific order

  1. #1
    VBAX Regular
    Joined
    May 2016
    Posts
    69
    Location

    Sorting Sheets in a specific order

    First and foremost, I do have a post from this morning on MrExcel.com. However, I am changing my question.

    Say I have tabs with the following numerical names and those tabs come in sorted in numerical order from a tool that runs report.
    However, I want the tabs to be in a very specific order.

    For example, say I have the following tabs: 1,2,3,4,5,6,7,8,9,10

    But I need them in this specific order: 5,2,8,9,3,1,4,6,7,10

    How can I instruct Excel to sort my tabs in that order.

    It will be the same exact order every month, so I would rather have the tab names sorted in the VBA code rather than have VBA read the list from a spreadsheet and sort.

    Thanks

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    For Each n In Array(5, 2, 8, 9, 3, 1, 4, 6, 7, 10)
        Sheets(CStr(n)).Move after:=Sheets(Sheets.Count)
    Next n
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    May 2016
    Posts
    69
    Location
    This my friend, is perfect

    Thank You

Posting Permissions

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