Bookmark and Share

Enter your email address:

Delivered by FeedBurner

Home Page

Subscribe here
Add to My Yahoo!
This page is powered by Blogger. Isn't yours?

Host your Web site with PureHost!

eXTReMe Tracker

  Friday, November 14, 2008 – Permalink –

Sort Worksheets

Order tabs

Worksheets can be dragged and dropped into any order required. They can be set up in numeric or alpha order, but doing it by hand is a bother.

Chip Pearson has written some macros that will do the job for you:

  • Sorting Worksheets In Alphabetical Order
  • Sorting In Custom Order
  • Grouping Sheets By Color

Here's the code to sort by tab color:

Sub GroupSheetsByColor()
Dim Ndx As Long
Dim Ndx2 As Long
For Ndx = 1 To Worksheets.Count - 1
For Ndx2 = Ndx To Worksheets.Count
If Worksheets(Ndx2).Tab.ColorIndex = _
Worksheets(Ndx).Tab.ColorIndex Then
Worksheets(Ndx2).Move after:=Worksheets(Ndx)
End If
Next Ndx2
Next Ndx
End Sub

Sorting Worksheets In A Workbook

(The colorindex variable chooses one of the 56 colors in Excel's basic palette.
Here are all the colors and numbers as compiled by F. David McRitchie:
Excel Colors )

[Edited entry from 8/30/2005]

See all Topics


<Doug Klippert@ 3:35 AM

Comments: Post a Comment

Links to this post:

Create a Link