Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Worksheet Tabs
I have a bunch of tabs and the name's are numbers. Any way to sort the tabs
with a macro. Thanks Frank |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Worksheet Tabs
Option Explicit
Sub SortWorksheets() Dim sCount As Integer, i As Integer, j As Integer 'Application.ScreenUpdating = False sCount = Worksheets.Count If sCount = 1 Then Exit Sub For i = 1 To sCount - 1 For j = i + 1 To sCount If Worksheets(j).Name < Worksheets(i).Name Then Worksheets(j).Move Befo=Worksheets(i) End If Next j Next i End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Worksheet Tabs
Try this
Sub sortem() For a = 1 To Sheets.Count - 1 For b = a + 1 To Sheets.Count If (Sheets(a).Name) (Sheets(b).Name) Then Sheets(b).Move Befo=Sheets(a) End If Next b Next a End Sub Mike "Beep Beep" wrote: I have a bunch of tabs and the name's are numbers. Any way to sort the tabs with a macro. Thanks Frank |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Worksheet Tabs
You can click and drag them by the tabs and move them to their rightful
locations--or you could run 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, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Remember that the names are strings, so 1 2 11 12 20 30 will sort like: 1 11 12 2 20 30 You'll have to either adjust the code to convert the names to numbers--or use a nice format for your worksheet names: 0001 0002 0011 0012 0020 0030 .... Beep Beep wrote: I have a bunch of tabs and the name's are numbers. Any way to sort the tabs with a macro. Thanks Frank -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sort Worksheet Tabs | Excel Programming | |||
Is it possible to sort the tabs in a workbook? | Excel Discussion (Misc queries) | |||
Sort tabs | Excel Discussion (Misc queries) | |||
Sort the Tabs | Excel Programming | |||
Re-Sort Worksheet tabs | Excel Worksheet Functions |