+ Reply to Thread
Results 1 to 6 of 6

Can you sort sheet tabs in a workbook

  1. #1
    Techtrainer
    Guest

    Can you sort sheet tabs in a workbook

    How can I sort the sheet tabs in my workbook

  2. #2
    Don Guillett
    Guest

    Re: Can you sort sheet tabs in a workbook

    try

    Sub SortALLSheetsbyName() 'McRitchie
    'sort sheets within a workbook in Excel 7 -- Bill Manville
    'modified to sort all sheets instead of just worksheets
    Dim iSheet As Integer, iBefore As Integer
    For iSheet = 1 To ActiveWorkbook.Sheets.Count
    Sheets(iSheet).Visible = True
    For iBefore = 1 To iSheet - 1
    If UCase(Sheets(iBefore).Name) > UCase(Sheets(iSheet).Name) Then
    ActiveWorkbook.Sheets(iSheet).Move
    Before:=ActiveWorkbook.Sheets(iBefore)
    Exit For
    End If
    Next iBefore
    Next iSheet
    End Sub

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "Techtrainer" <Techtrainer@discussions.microsoft.com> wrote in message
    news:D73A9DB9-ADCC-40D4-96D8-52103A96ED4A@microsoft.com...
    > How can I sort the sheet tabs in my workbook




  3. #3
    Techtrainer
    Guest

    RE: Can you sort sheet tabs in a workbook



    "Techtrainer" wrote:

    > How can I sort the sheet tabs in my workbook


    Thanks for the response!
    I am getting an error thougn on the following line
    ActiveWorkbook.Sheets(iSheet).Move
    Before:=ActiveWorkbook.Sheets(iBefore)

    Compiler doesn't seem to like :=

  4. #4
    Techtrainer
    Guest

    Re: Can you sort sheet tabs in a workbook

    Thank you!!
    I wrote back about an error I was getting but it was just a syntax problem.
    I got it corrected and it works fine.
    Thank You !!!
    Bill vernola

    "Don Guillett" wrote:

    > try
    >
    > Sub SortALLSheetsbyName() 'McRitchie
    > 'sort sheets within a workbook in Excel 7 -- Bill Manville
    > 'modified to sort all sheets instead of just worksheets
    > Dim iSheet As Integer, iBefore As Integer
    > For iSheet = 1 To ActiveWorkbook.Sheets.Count
    > Sheets(iSheet).Visible = True
    > For iBefore = 1 To iSheet - 1
    > If UCase(Sheets(iBefore).Name) > UCase(Sheets(iSheet).Name) Then
    > ActiveWorkbook.Sheets(iSheet).Move
    > Before:=ActiveWorkbook.Sheets(iBefore)
    > Exit For
    > End If
    > Next iBefore
    > Next iSheet
    > End Sub
    >
    > --
    > Don Guillett
    > SalesAid Software
    > dguillett1@austin.rr.com
    > "Techtrainer" <Techtrainer@discussions.microsoft.com> wrote in message
    > news:D73A9DB9-ADCC-40D4-96D8-52103A96ED4A@microsoft.com...
    > > How can I sort the sheet tabs in my workbook

    >
    >
    >


  5. #5
    Chip Pearson
    Guest

    Re: Can you sort sheet tabs in a workbook

    The lines

    ActiveWorkbook.Sheets(iSheet).Move
    Before:=ActiveWorkbook.Sheets(iBefore)

    should all be on one line in the code module.

    See also www.cpearson.com/excel/sortws.htm for a procedure to
    sort worksheets.

    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Techtrainer" <Techtrainer@discussions.microsoft.com> wrote in
    message
    news:1B4D8170-7AFE-430F-8289-019B05BC58D2@microsoft.com...
    >
    >
    > "Techtrainer" wrote:
    >
    >> How can I sort the sheet tabs in my workbook

    >
    > Thanks for the response!
    > I am getting an error thougn on the following line
    > ActiveWorkbook.Sheets(iSheet).Move
    > Before:=ActiveWorkbook.Sheets(iBefore)
    >
    > Compiler doesn't seem to like :=




  6. #6
    Techtrainer
    Guest

    Re: Can you sort sheet tabs in a workbook

    Thanks Chip!

    "Chip Pearson" wrote:

    > The lines
    >
    > ActiveWorkbook.Sheets(iSheet).Move
    > Before:=ActiveWorkbook.Sheets(iBefore)
    >
    > should all be on one line in the code module.
    >
    > See also www.cpearson.com/excel/sortws.htm for a procedure to
    > sort worksheets.
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    > "Techtrainer" <Techtrainer@discussions.microsoft.com> wrote in
    > message
    > news:1B4D8170-7AFE-430F-8289-019B05BC58D2@microsoft.com...
    > >
    > >
    > > "Techtrainer" wrote:
    > >
    > >> How can I sort the sheet tabs in my workbook

    > >
    > > Thanks for the response!
    > > I am getting an error thougn on the following line
    > > ActiveWorkbook.Sheets(iSheet).Move
    > > Before:=ActiveWorkbook.Sheets(iBefore)
    > >
    > > Compiler doesn't seem to like :=

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1