Sorting sheets

Damo10

Active Member
Joined
Dec 13, 2010
Messages
460
Hi,

I have a workbook with lots of sheets, is it possible to have a macro that will sort the sheets alphanumerically but to keep sheets "Main",Summary" & "Report" as the first ones. I would like to run this after my add new sheet macro.

Regards
 
My mistake in use of word recursive but thank you for the explanation, wasn't aware of the implications of stable and unstable sorts and yes, watching the tabs move, effectively is "sorting the sheets on the fly". Cheers!
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
BTW, as written, it does a case-sensitive sort (dunno why I needed that at the time). To change that, change this line

Code:
                If .Sheets(i).Name < .Sheets(j).Name Then

to

Code:
                If StrComp(.Sheets(i).Name, .Sheets(j).Name, vbTextCompare) <> 1 Then
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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