+ Reply to Thread
Results 1 to 3 of 3

sorting and deleting sheets

  1. #1
    Spike
    Guest

    sorting and deleting sheets

    i will be grateful for a piece of code to sort all the sheets in a workbook,
    say to the left of a certain sheet, and also a piece of code to delete all
    the worksheets say to the right of a certain sheet.

    I am sure this must have been asked before but i cannot find it in the forum
    --
    with kind regards

    Spike

  2. #2
    Tom Ogilvy
    Guest

    RE: sorting and deleting sheets

    You probably should delete the sheets first, then sort the rest - or vice
    versa - depending on the functionality you want. To delete sheets from the
    right side of the tab order:

    for i = worksheets.count to 5 step -1
    Application.displayAlerts = False
    Worksheets(i).Delete
    Application.DisplayAlerts = True
    Next

    to sort sheets in the tab order you can use code like this at Chip Pearson's
    site:
    http://www.cpearson.com/excel/sortws.htm

    --
    Regards,
    Tom Ogilvy


    "Spike" wrote:

    > i will be grateful for a piece of code to sort all the sheets in a workbook,
    > say to the left of a certain sheet, and also a piece of code to delete all
    > the worksheets say to the right of a certain sheet.
    >
    > I am sure this must have been asked before but i cannot find it in the forum
    > --
    > with kind regards
    >
    > Spike


  3. #3
    Spike
    Guest

    RE: sorting and deleting sheets

    excellent many thanks
    --
    with kind regards

    Spike


    "Tom Ogilvy" wrote:

    > You probably should delete the sheets first, then sort the rest - or vice
    > versa - depending on the functionality you want. To delete sheets from the
    > right side of the tab order:
    >
    > for i = worksheets.count to 5 step -1
    > Application.displayAlerts = False
    > Worksheets(i).Delete
    > Application.DisplayAlerts = True
    > Next
    >
    > to sort sheets in the tab order you can use code like this at Chip Pearson's
    > site:
    > http://www.cpearson.com/excel/sortws.htm
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Spike" wrote:
    >
    > > i will be grateful for a piece of code to sort all the sheets in a workbook,
    > > say to the left of a certain sheet, and also a piece of code to delete all
    > > the worksheets say to the right of a certain sheet.
    > >
    > > I am sure this must have been asked before but i cannot find it in the forum
    > > --
    > > with kind regards
    > >
    > > Spike


+ 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