Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I alphabetize sheet tabs within a worksheet?
|
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I alphabetize sheet tabs within a worksheet?
On Wed, 2 Apr 2008 08:16:03 -0700, Michelle
wrote: You need a Macro to do that. Put this into a regular module: ================= Option Explicit Sub SortWorksheets() Dim N As Integer Dim M As Integer Dim FirstWSToSort As Integer Dim LastWSToSort As Integer Dim SortDescending As Boolean SortDescending = False If ActiveWindow.SelectedSheets.Count = 1 Then FirstWSToSort = 1 LastWSToSort = Worksheets.Count Else With ActiveWindow.SelectedSheets For N = 2 To .Count If .Item(N - 1).Index < .Item(N).Index - 1 Then MsgBox "You cannot sort non-adjacent sheets" Exit Sub End If Next N FirstWSToSort = .Item(1).Index LastWSToSort = .Item(.Count).Index End With End If For M = FirstWSToSort To LastWSToSort For N = M To LastWSToSort If SortDescending = True Then If UCase(Worksheets(N).Name) UCase(Worksheets(M).Name) Then Worksheets(N).Move Befo=Worksheets(M) End If Else If UCase(Worksheets(N).Name) < UCase(Worksheets(M).Name) Then Worksheets(N).Move Befo=Worksheets(M) End If End If Next N Next M End Sub ======================== --ron |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I alphabetize sheet tabs within a worksheet?
Check your other post, too.
Michelle wrote: -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I alphabetize sheet tabs within a worksheet?
On Wed, 02 Apr 2008 11:44:20 -0400, Ron Rosenfeld
wrote: On Wed, 2 Apr 2008 08:16:03 -0700, Michelle wrote: You need a Macro to do that. Put this into a regular module: By the way, I did not write this macro -- but I cannot recall where I found it. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to alphabetize worksheet tabs? | Excel Discussion (Misc queries) | |||
is it possible to alphabetize worksheet tabs? | Excel Worksheet Functions | |||
alphabetize tabs | Excel Discussion (Misc queries) | |||
Simplest way to alphabetize sheet tabs | Excel Discussion (Misc queries) | |||
How to Alphabetize Worksheet Tabs? | New Users to Excel |