Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Alphabetizing Worksheets

http://www.cpearson.com/excel/sortws.aspx
--
Gary''s Student - gsnu200770
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alphabetizing DeniseB Excel Worksheet Functions 1 April 9th 10 01:09 AM
Alphabetizing Worksheets clawrenc Excel Discussion (Misc queries) 1 December 29th 06 07:09 PM
Alphabetizing mulitiple worksheets in Excel 2003? Deena at DCH FD Excel Discussion (Misc queries) 2 June 13th 06 04:24 PM
Alphabetizing Worksheets Dave Excel Worksheet Functions 3 March 16th 06 06:56 PM
Alphabetizing Jordangirl78 Excel Worksheet Functions 5 November 5th 04 06:39 AM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"