Hi
this isn't mine can't remember where I got it to give credit but it
works, biggest spreadsheet I have used it on is about 40 tabs.

Dim lCount As Long, lCounted As Long
Dim lShtLast As Long
Dim lReply As Long
lReply = MsgBox("Your worksheets are about to sort in ascending order,
to proceed, select 'Yes'. " _
& "To cancel select 'No'", vbYesNo)
If lReply = vbNo Then Exit Sub
lShtLast = Sheets.Count
    If lReply = vbYes Then 'Sort ascending
        For lCount = 1 To lShtLast
            For lCount2 = lCount To lShtLast
                If UCase(Sheets(lCount2).Name) < UCase(Sheets
(lCount).Name) Then
                    Sheets(lCount2).Move Before:=Sheets(lCount)
                End If
               Next lCount2
        Next lCount
     End If


Yorkeyite


On Feb 2, 2:40 pm, Amanda <propagan...@gmail.com> wrote:
> Hi,
>
> I am going to be working on a spreadsheet which will have a tab for
> every member of staff in my faculty (could be over 100 tabs).
>
> I need to write a Macro that will, when run, sort the tabs into
> alphabetical order (they will be named as 'Last name, First name'). Is
> this possible?
>
> Also, it would be great if, when we re-run the macro as the semester
> progresses and more people are added, we can re-run the macro and it
> will re-read all the tabs and include the new tabs in the re-ordering.
>
> Thanks,
> Amanda

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
 
If you find any spam message in the group, please send an email to Ayush @ 
jainayus...@gmail.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to