Sorting the sheets in a workbook ?

  • Thread starter Thread starter Eric_in_EVV
  • Start date Start date
E

Eric_in_EVV

Is there a way to sort the sheets in a workbook to have them in alphabetical
order....other than manually moving them ?

Hoping for a "yes" answer.....and thanks !
 
David McRitchie's site has this macro to sort the sheets in a workbook:

Sub SortALLSheets()
'sort sheets within a workbook in Excel 7 -- Bill Manville
'modified to sort all sheets instead of just worksheets
Dim iSheet As Long, iBefore As Long
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
Before:=ActiveWorkbook.Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub

His site is located at:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#sortallsheets

Hope this helps,

Hutch
 
I really was expecting the answer to be "no way can that be done"....so I'm
thrilled to see yuor reply. I'm going to copy the code below and check it
out...will also visit David McRitchie's site !

How Sweet it is !!

Thanks !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top