Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Worksheets in alphabetical order

I am using Excel 97.

I want to sort worksheets in a workbook so that they are
in alphabetical order.

Can anyone asist me with some code?

Thanks


Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Worksheets in alphabetical order

Sub SortALLSheets()
'sort sheets within a workbook in Excel 7 -- Bill Manville
'modified to sort all sheets instead of just worksheets
Dim iSheet As Integer, iBefore As Integer
For iSheet = 1 To ActiveWorkbook.Sheets.Count
Sheets(iSheet).Visible = True
For iBefore = 1 To iSheet - 1
If UCase(Sheets(iBefore).Name) UCase(Sheets(iSheet).Name) Then
ActiveWorkbook.Sheets(iSheet).Move
Befo=ActiveWorkbook.Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub

Rgds,
Andy


On the stereo this week ; Albinoni, Samuel Barber, Nirvana, Sinead O'Connor


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Worksheets in alphabetical order


Hi Mark,

For sorting sheet tab copy below code to your standard module & run
macro sortsheet.

---------------------------------------------------
Sub Sortsheet()
Quicksortsheets ' without arguments for ascending
'Quicksortsheets "D" ' with arguments for descending
end sub

Sub QuickSortSheets(Optional SortOrder)
Dim i As Long
Dim j As Long
Dim SheetsCount As Long
Dim FirstSheet As String
Dim NextSheet As String
Dim LValue As String
Dim HValue As String
Dim VTemp As String
Application.ScreenUpdating = 0
SheetsCount = Worksheets.Count
For i = 1 To SheetsCount \ 2
FirstSheet = Worksheets(i).Name
LValue = FirstSheet
HValue = FirstSheet
For j = i To SheetsCount - 1
NextSheet = Worksheets(j + 1).Name
If LValue NextSheet Then LValue = NextSheet
If HValue < NextSheet Then HValue = NextSheet
Next
If IsMissing(SortOrder) Then
Else
VTemp = LValue
LValue = HValue
HValue = VTemp
End If
If LValue < FirstSheet Then Worksheets
(LValue).Move befo=Worksheets(i)
If HValue < Worksheets(SheetsCount).Name Then
Worksheets(HValue).Move after:=Worksheets(SheetsCount)
SheetsCount = SheetsCount - 1
Next
Application.ScreenUpdating = 1
End Sub



You can also see below sites

www.cpearson.com/excel/sortws.htm

http://www.mvps.org/dmcritchie/excel...#sortallsheets


Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Worksheets in alphabetical order

Hi Mark,

Here is a simple code I wrote. Please try this.

Sub WorksheetSort()
Dim intC1 As Long, intC2 As Integer
For intC1 = 1 To Sheets.Count
For intC2 = 1 To Sheets.Count - 1
If Sheets(intC2).Name Sheets(intC2 + 1).Name Then
Sheets(intC2).Move after:=Sheets(intC2 + 1)
End If
Next intC2, intC1
End Sub


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


"Mark" wrote in message
...
I am using Excel 97.

I want to sort worksheets in a workbook so that they are
in alphabetical order.

Can anyone asist me with some code?

Thanks


Mark


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 arrange worksheets in alphabetical order? Rohit Rathi Excel Worksheet Functions 1 July 11th 09 01:50 PM
How to arrange worksheets in alphabetical order? Rohit Rathi Excel Worksheet Functions 2 July 11th 09 01:24 PM
How to put worksheets in Alphabetical order? LiveUser Excel Discussion (Misc queries) 6 January 16th 08 03:45 PM
How do I put worksheets in alphabetical order DLee New Users to Excel 2 July 27th 05 09:16 PM
How do I put worksheets in alphabetical order DLee Excel Worksheet Functions 1 July 27th 05 08:41 PM


All times are GMT +1. The time now is 12:15 AM.

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"