Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could you check my post named Sorting Worksheets Numerically please
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can try this:
Sub SortWorksheets() Dim N As Integer Dim M As Integer Dim FirstWSToSort As Integer Dim LastWSToSort As Integer Dim SortDescending As Boolean Dim sN as String, sM as String Dim MaxLen as Long SortDescending = False FirstWSToSort = 1 LastWSToSort = Worksheets.Count For M = FirstWSToSort To LastWSToSort If Len(Worksheets(M).Name) MaxLen Then MaxLen = Len(Worksheets(M).Name) End If Next For M = FirstWSToSort To LastWSToSort - 1 For N = M + 1 To LastWSToSort sN = Right(Space(MaxLen) & _ UCase(Worksheets(N).Name), MaxLen) sM = Right(Space(MaxLen) & _ UCase(Worksheets(M).Name), MaxLen) If SortDescending = True Then If sN sM Then Worksheets(N).Move Befo=Worksheets(M) End If Else If sN < sM Then Worksheets(N).Move Befo=Worksheets(M) End If End If Next N Next M End Sub -- Regards, Tom Ogilvy "jnf40" wrote in message ... Could you check my post named Sorting Worksheets Numerically please |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dave phlogiston appears in spreadsheet cell when I type Dave P | Excel Discussion (Misc queries) | |||
Dave Peterson...HELP!!!! | Excel Discussion (Misc queries) | |||
Dave Peterson | Excel Discussion (Misc queries) | |||
to Dave Peterson | Excel Discussion (Misc queries) | |||
Dave - | Excel Programming |