Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Alphabetizing Worksheets
I have used a program by someone else that is supposed to alphabetize my
worksheets. Unfortunately I'm not sure how to debug the code. This is a portion of what I have: ''''''''''''''''''''''''''''''''''''''''''''''' ' If First and Last are both 0, sort all sheets. '''''''''''''''''''''''''''''''''''''''''''''' If (FirstToSort = 0) And (LastToSort = 0) Then FirstToSort = 1 LastToSort = WB.Worksheets.Count Else ''''''''''''''''''''''''''''''''''''''' ' More than one sheet selected. We ' can sort only if the selected ' sheet are adjacent. ''''''''''''''''''''''''''''''''''''''' B = TestFirstLastSort(FirstToSort, LastToSort, ErrorText) If B = False Then SortWorksheetsByName = False Exit Function End If End If When I "debug" I get the following message: Compile Error: Sub or Function not defined Do you need to know more to help me? I'm a little clueless, to say the least on this. I've tried looking at different sites, but without totally understanding the coding, I'm not sure what I'm looking for, or how to cure the issue. Thank you for your help... in advance. A lot of you guys/gals on here that help are VERY much appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Alphabetizing Worksheets
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Alphabetizing Worksheets
On Feb 24, 6:52*am, geigersc
wrote: I have used a program by someone else that is supposed to alphabetize my worksheets. *Unfortunately I'm not sure how to debug the code. *This is a portion of what I have: ''''''''''''''''''''''''''''''''''''''''''''''' ' If First and Last are both 0, sort all sheets. '''''''''''''''''''''''''''''''''''''''''''''' If (FirstToSort = 0) And (LastToSort = 0) Then * * FirstToSort = 1 * * LastToSort = WB.Worksheets.Count Else * * ''''''''''''''''''''''''''''''''''''''' * * ' More than one sheet selected. We * * ' can sort only if the selected * * ' sheet are adjacent. * * ''''''''''''''''''''''''''''''''''''''' * * B = TestFirstLastSort(FirstToSort, LastToSort, ErrorText) * * If B = False Then * * * * SortWorksheetsByName = False * * * * Exit Function * * End If End If When I "debug" I get the following message: Compile Error: Sub or Function not defined Do you need to know more to help me? *I'm a little clueless, to say the least on this. *I've tried looking at different sites, but without totally understanding the coding, I'm not sure what I'm looking for, or how to cure the issue. Thank you for your help... in advance. *A lot of you guys/gals on here that help are VERY much appreciated. Try this Option Explicit -------------------------------------------------------------------------------- Sub SortingWks() Dim i As Long Dim j As Long For i = 1 To Worksheets.Count j = i Do While j 1 If Worksheets(j).Name < Worksheets(j - 1).Name Then Worksheets(j).Move Befo=Worksheets(j - 1) End If j = j - 1 Loop Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Alphabetizing | Excel Worksheet Functions | |||
Alphabetizing Worksheets | Excel Discussion (Misc queries) | |||
Alphabetizing mulitiple worksheets in Excel 2003? | Excel Discussion (Misc queries) | |||
Alphabetizing Worksheets | Excel Worksheet Functions | |||
Alphabetizing | Excel Worksheet Functions |