ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Alphabatizing my worksheets (https://www.excelbanter.com/excel-programming/424485-alphabatizing-my-worksheets.html)

John

Alphabatizing my worksheets
 
What code might I use to sort all the worksheets except the master summary
sheet into alphabetic order? (The master summary sheet's tab name is unique
and I want it to always be the first tab in the workbook.)

Dave Peterson

Alphabatizing my worksheets
 
You could use a macro...

Chip Pearson's:
http://www.cpearson.com/excel/sortws.htm

David McRitchie's:
http://www.mvps.org/dmcritchie/excel...#sortallsheets

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

=======
And I'd just let the macro sort the mastersheet, too. Then after the sort, you
can add code to move it to the leftmost position.

Sheets("summary").Move befo=Sheets(1)

(change the name as required.)

John wrote:

What code might I use to sort all the worksheets except the master summary
sheet into alphabetic order? (The master summary sheet's tab name is unique
and I want it to always be the first tab in the workbook.)


--

Dave Peterson

keiji kounoike

Alphabatizing my worksheets
 
This is a very primitive one. But try it.

Sub sortsheetname()
Dim n As Long, i As Long
For n = Worksheets.Count To 1 Step -1
For i = 2 To n - 1
If Worksheets(i).Name Worksheets(i + 1).Name Then
Worksheets(i).Move after:=Worksheets(i + 1)
End If
Next
Next
End Sub

Keiji

John wrote:
What code might I use to sort all the worksheets except the master summary
sheet into alphabetic order? (The master summary sheet's tab name is unique
and I want it to always be the first tab in the workbook.)


John

Alphabatizing my worksheets
 
This was a lot of help. Thx for all the additional links!

I appreciate your help, -John

"Dave Peterson" wrote:

You could use a macro...

Chip Pearson's:
http://www.cpearson.com/excel/sortws.htm

David McRitchie's:
http://www.mvps.org/dmcritchie/excel...#sortallsheets

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

=======
And I'd just let the macro sort the mastersheet, too. Then after the sort, you
can add code to move it to the leftmost position.

Sheets("summary").Move befo=Sheets(1)

(change the name as required.)

John wrote:

What code might I use to sort all the worksheets except the master summary
sheet into alphabetic order? (The master summary sheet's tab name is unique
and I want it to always be the first tab in the workbook.)


--

Dave Peterson



All times are GMT +1. The time now is 05:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com