Sorting Excel Tabs in Alpha Numerical Order

Peppertaker

New Member
Joined
Mar 8, 2016
Messages
23
Need help in sorting my tabs in Alpha Numerical order. I have the following tabs in my workbook... "All Info, Totals By District, Totals by VPN, District 1, District 2, etc up to District 13. When I use the code below it sorts tabs alphabetically, but it list the Districts in order of 1, 10, 11, 12, 13. Can someone please help alter this macro to sort the tabs so Districts 10, 11, 12, 13 actually come after the District 9 tab?

Sub Sortem()
Dim x As Long, y As Long
For x = 1 To Worksheets.Count
For y = x To Worksheets.Count
If UCase(Sheets(y).Name) < UCase(Sheets(x).Name) Then
Sheets(y).Move before:=Sheets(x)
End If
Next
Next
End Sub


Thanks.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I've viewed this link but it doesn't sort the way I need it to. It still sorts my districts as 1, 10, 11, 12, 13, 2, 3, ,4 etc.
 
Upvote 0
Peppertaker,

There is a lot of good information on the web if you search for:

Sorting Excel Tabs in Alpha Numerical Order


If you still can not find a solution, then:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
Peppertaker,

There are a lot of examples on MrExcel.

In the upper right hand corner of the MrExcel banner page, click on Advanced Search

On the page that opens:

In the box to the right of Keyword(s): enter "Sort Sheets" with the " characters.

And, click on the Search Now button.
 
Upvote 0
Out of curiosity does it work for you if you change District 9 to District 09, District 4 to District 04, etc?
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top