Solved

Excel-how to sort worksheet names alphbetically

Posted on 2002-03-12
2
180 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
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
Comment Utility
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
Comment Utility
Thank you so much! It worked great.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
This article will show you how to use shortcut menus in the Access run-time environment.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now