View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andy Brown Andy Brown is offline
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