Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
[Q] How to sort tabs in order of CodeName
Is there a way in VBA to sort the worksheets/tabs in the order of each
worksheet's CodeName? The code below sorts the sheets in alphabetical order, but how can change it to sort via CodeName? Sub SortWorksheets() ' sort worksheets in a workbook in ascending order Dim sCount As Integer, i As Integer, j As Integer Application.ScreenUpdating = False sCount = Sheets.Count If sCount = 1 Then Exit Sub For i = 1 To sCount - 1 For j = i + 1 To sCount If Sheets(j).Name < Sheets(i).Name Then Sheets(j).Move Befo=Sheets(i) End If Next j Next i End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using CodeName when Selecting Multi-Tabs | Excel Programming | |||
Retaining Sort order in the Sort Dialog box | Excel Discussion (Misc queries) | |||
Sort sheet based on particuilar sort order | Excel Worksheet Functions | |||
Sort sheet tabs in alphabetical or numerical order | Excel Discussion (Misc queries) | |||
Pls. reply Sort Data and copy to next coulmn when sort order chang | Excel Programming |