ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Organize the worksheets in numerical order (https://www.excelbanter.com/excel-programming/435432-organize-worksheets-numerical-order.html)

TGalin

Organize the worksheets in numerical order
 
I have a workbook with sheets that have similar names. The only difference
between the worksheet names is the numbers included in them. Is it possible,
using a macro, to organize the worksheets in numerical order?

Gord Dibben

Organize the worksheets in numerical order
 
Depends upon where "included numbers" are located in the sheet name.

Mike's macro will sort by numbers included within or at either end of sheet
names.

Sub sort_sheets()
'Mike H June 13th, 2007
Dim I As Integer, J As Integer

For I = 1 To Sheets.Count - 1
For J = I + 1 To Sheets.Count
If UCase(Sheets(I).Name) UCase(Sheets(J).Name) Then
Sheets(J).Move befo=Sheets(I)
End If
Next J
Next I
End Sub


Gord Dibben MS Excel MVP

On Mon, 26 Oct 2009 12:21:02 -0700, TGalin
wrote:

I have a workbook with sheets that have similar names. The only difference
between the worksheet names is the numbers included in them. Is it possible,
using a macro, to organize the worksheets in numerical order?



TGalin

Organize the worksheets in numerical order
 
Thank you. This is what I needed.

"Gord Dibben" wrote:

Depends upon where "included numbers" are located in the sheet name.

Mike's macro will sort by numbers included within or at either end of sheet
names.

Sub sort_sheets()
'Mike H June 13th, 2007
Dim I As Integer, J As Integer

For I = 1 To Sheets.Count - 1
For J = I + 1 To Sheets.Count
If UCase(Sheets(I).Name) UCase(Sheets(J).Name) Then
Sheets(J).Move befo=Sheets(I)
End If
Next J
Next I
End Sub


Gord Dibben MS Excel MVP

On Mon, 26 Oct 2009 12:21:02 -0700, TGalin
wrote:

I have a workbook with sheets that have similar names. The only difference
between the worksheet names is the numbers included in them. Is it possible,
using a macro, to organize the worksheets in numerical order?


.



All times are GMT +1. The time now is 06:03 AM.

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