Excel worksheets
I wonder if there is a quick way to put the sheets within a workbook into
numerical/alphabetical order. |
Excel worksheets
Macro is the only quick way
http://www.cpearson.com/excel/sortws.aspx on how to install macros http://www.mvps.org/dmcritchie/excel/install.htm -- Regards, Peo Sjoblom "lorwoman" wrote in message ... I wonder if there is a quick way to put the sheets within a workbook into numerical/alphabetical order. |
Excel worksheets
An internet search for "sort excel worksheets' turns up several sites
offering solutioins. One of those is the Ozgrid site, a good source, which published this code: Sub SortSheets() Dim lCount As Long, lCounted As Long Dim lShtLast As Long Dim lReply As Long lReply = MsgBox("To sort Worksheets ascending, select 'Yes'. " _ & "To sort Worksheets descending select 'No'", vbYesNoCancel, "Ozgrid Sheet Sort") If lReply = vbCancel Then Exit Sub lShtLast = Sheets.Count If lReply = vbYes Then 'Sort ascending For lCount = 1 To lShtLast For lCount2 = lCount To lShtLast If UCase(Sheets(lCount2).Name) < UCase(Sheets(lCount).Name) Then Sheets(lCount2).Move Befo=Sheets(lCount) End If Next lCount2 Next lCount Else 'Sort descending For lCount = 1 To lShtLast For lCount2 = lCount To lShtLast If UCase(Sheets(lCount2).Name) UCase(Sheets(lCount).Name) Then Sheets(lCount2).Move Befo=Sheets(lCount) End If Next lCount2 Next lCount End If End Sub To put the code into your workbook, press [Alt]+[F11] to enter the VB Editor and then choose Insert | Module and copy and paste the code above into the module presented to you, close the VB Editor and run the code from Tools | Macro | Macros. Chip Pearson also has a good solution (one I've borrowed myself in the past) at his site on this page: http://www.cpearson.com/Excel/sortws.aspx "lorwoman" wrote: I wonder if there is a quick way to put the sheets within a workbook into numerical/alphabetical order. |
All times are GMT +1. The time now is 04:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com