Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel-how to sort worksheet names alphbetically

Posted on 2002-03-12
2
Medium Priority
?
191 Views
Last Modified: 2007-12-19
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)
0
Comment
Question by:aib1996
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 6856843
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
    Next
  Next

End Sub

Cheers
0
 

Author Comment

by:aib1996
ID: 6856958
Thank you so much! It worked great.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question