[mso] Re: Excel

  • From: David Good - ANSYS Europe <david.good@xxxxxxxxx>
  • To: "'mso@xxxxxxxxxxxxx'" <mso@xxxxxxxxxxxxx>
  • Date: Fri, 20 Dec 2002 05:45:36 -0500

Now now, play nice we're only trying to help :)

I found the following code at:
http://www.cpearson.com/excel/sortws.htm

Hope it works for you, and I hope you feel inclined to stay with us on the
list.

If you need any help on importing this into Excel into a macro you can use
just shout!

Dave.


Sub SortWorksheets()
    Dim N As Integer
    Dim M As Integer
    Dim FirstWSToSort As Integer
    Dim LastWSToSort As Integer
    Dim SortDescending As Boolean
    
    SortDescending = False
    
    If ActiveWindow.SelectedSheets.Count = 1 Then
        FirstWSToSort = 1
        LastWSToSort = Worksheets.Count
    Else
        With ActiveWindow.SelectedSheets
            For N = 2 To .Count
                If .Item(N - 1).Index <> .Item(N).Index - 1 Then
                    MsgBox "You cannot sort non-adjacent sheets"
                    Exit Sub
                End If
            Next N
            FirstWSToSort = .Item(1).Index
            LastWSToSort = .Item(.Count).Index
         End With
    End If
    For M = FirstWSToSort To LastWSToSort
        For N = M To LastWSToSort
            If SortDescending = True Then
                If UCase(Worksheets(N).Name) > UCase(Worksheets(M).Name)
Then
                    Worksheets(N).Move Before:=Worksheets(M)
                End If
            Else
                If UCase(Worksheets(N).Name) < UCase(Worksheets(M).Name)
Then
                   Worksheets(N).Move Before:=Worksheets(M)
                End If
            End If
         Next N
    Next M
End Sub






-----Original Message-----
From: Cherie [mailto:msogroup@xxxxxxxxxxx] 
Sent: 20 December 2002 01:20
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Excel



At 12/18/2002, Skuce, John got up on a soap box and shouted:
----------------------Begin Quote------------------------  >Put your mouse
on the tab name and hold down the left mouse button and drag  >the worksheet
tabs to the order you would like them to be in.  >  >I hope this helps.  >
>John ----------------------End Quote------------------------


original message said "QUICKLY" alphabetize...I know how to do it that 
way..and believe me..it is NOT quick..'specially when there are over 25 
worksheets to do

Can someone answer if there is another way to alphabetize the sheets? I 
joined this list to get just this answer..if there is not an answer..I can 
move on
thanks anyway
C

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files: http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: