Excel-how to sort worksheet names alphbetically

Hi, I have an Excel file that has ALOT of worksheets and I have named each on it's tab, but now I want to sort them alphbetically. The only way I know how is to drag the tab and do it manually. Anyone know a quicker way? Thanks! (I have Excel 2000 on a PC)
Who is Participating?
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
paste this macro into your worksheet, and let it run.

Public Sub SortSheets()
  Dim lngSheet As Long
  Dim objSheet As Worksheet
  Dim lngLoop As Long
  Dim objLoop As Worksheet
  For lngSheet = 2 To ThisWorkbook.Sheets.Count
    Set objSheet = ThisWorkbook.Sheets(lngSheet)
    For lngLoop = 1 To lngSheet - 1
      Set objLoop = ThisWorkbook.Sheets(lngLoop)
      If objSheet.Name < objLoop.Name Then
        objSheet.Move objLoop
        lngLoop = lngSheet
      End If

End Sub

aib1996Author Commented:
Thank you so much! It worked great.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.