Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 310
Default How do I alphabetize sheet tabs within a worksheet?


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How do I alphabetize sheet tabs within a worksheet?

Check your other post, too.

Michelle wrote:

--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to alphabetize worksheet tabs? joyfulnoiz Excel Discussion (Misc queries) 5 October 31st 07 05:51 PM
is it possible to alphabetize worksheet tabs? mel Excel Worksheet Functions 1 February 27th 07 12:50 AM
alphabetize tabs MarkT Excel Discussion (Misc queries) 4 October 12th 06 03:27 PM
Simplest way to alphabetize sheet tabs Bro23 Excel Discussion (Misc queries) 3 June 21st 06 07:57 PM
How to Alphabetize Worksheet Tabs? campbti New Users to Excel 0 March 10th 05 05:21 PM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"