Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 110
Default Does anyone know if there is a way to sort Excel worksheets?

I have created a number of Excel S/sheets in one document - but would like to
alphabeticise them... is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Does anyone know if there is a way to sort Excel worksheets?

"Steph" wrote:
I have created a number of Excel S/sheets in one document - but would like to
alphabeticise them... is this possible?


If you mean sort the worksheet by their names, try Chip Pearson's:
http://www.cpearson.com/excel/sortws.htm
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 772
Default Does anyone know if there is a way to sort Excel worksheets?

Previous post from Gord on a previous post from Chip:
Quick and dirty sort by name.

Sub sort_sheets()
'Mike H June 13th, 2007
Dim I As Integer, J As Integer

For I = 1 To Sheets.Count - 1
For J = I + 1 To Sheets.Count
If UCase(Sheets(I).Name) UCase(Sheets(J).Name) Then
Sheets(J).Move Befo=Sheets(I)
End If
Next J
Next I
End Sub

For more methods and flexibility see Chip pearson's site.

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


Gord Dibben MS Excel MVP


--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Steph" wrote:

I have created a number of Excel S/sheets in one document - but would like to
alphabeticise them... is this possible?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 430
Default Does anyone know if there is a way to sort Excel worksheets?

Give this a shot: (In a standard module)

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

"Steph" wrote in message
...
I have created a number of Excel S/sheets in one document - but would like
to
alphabeticise them... is this possible?



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 sort or aphabetize worksheets in Excel? Sis Excel Discussion (Misc queries) 4 June 30th 06 09:54 PM
Can I automatically sort worksheets in excel? Jimmy Excel Worksheet Functions 6 December 28th 05 08:00 PM
sellect and sort worksheets by name in excel Saurabh goel Excel Discussion (Misc queries) 1 June 14th 05 12:22 AM
How do I sort data into 2 worksheets in excel vba? luk_sr Excel Worksheet Functions 1 February 23rd 05 12:13 AM
how can i sort excel worksheets in alphabetical order? Birichica Excel Worksheet Functions 1 February 14th 05 06:25 PM


All times are GMT +1. The time now is 02:13 AM.

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

About Us

"It's about Microsoft Excel"