Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting Worksheets in Alphabetical Order (Left to Right)

Can anyone please suggest a way to organize the Worksheet Tabs i
alphabetical order running from left to right.

Thanks in Advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Sorting Worksheets in Alphabetical Order (Left to Right)

In a standard module put:

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

HTH - (Hope this helps)
JMay


"Jako " wrote in message
...
Can anyone please suggest a way to organize the Worksheet Tabs in
alphabetical order running from left to right.

Thanks in Advance.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Sorting Worksheets in Alphabetical Order (Left to Right)

Jako,

See this page at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

hth,

Doug Glancy

"Jako " wrote in message
...
Can anyone please suggest a way to organize the Worksheet Tabs in
alphabetical order running from left to right.

Thanks in Advance.


---
Message posted from http://www.ExcelForum.com/



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
Sorting in Custom Alphabetical Order Raj[_2_] Excel Worksheet Functions 2 February 4th 10 04:36 PM
Sorting Cells in Alphabetical Order by Last Name Maureen115 Excel Discussion (Misc queries) 1 October 17th 07 03:31 PM
How do I put worksheets in alphabetical order DLee Excel Worksheet Functions 1 July 27th 05 08:41 PM
sorting letters in words into alphabetical order bobf Excel Discussion (Misc queries) 5 March 21st 05 11:25 PM
Worksheets in alphabetical order Mark Excel Programming 3 November 28th 03 10:24 AM


All times are GMT +1. The time now is 05:21 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"