+ Reply to Thread
Results 1 to 2 of 2

Moving / sorting sheets in VBA

  1. #1
    Michael Beckinsale
    Guest

    Moving / sorting sheets in VBA

    Hi All,

    I have a series of identical sheets named LN1, LN2 etc up to LN20. They are
    sandwiched between sheets "start" & "end" and each cell is summed using
    =SUM(LN1:Ln2!A1) etc.

    The user has been given the functionality to remove (say LN2, LN3, LN4) from
    the protfolio by moving the sheets outside the "start" & "end" sandwich.

    The problem l am having is writing some code to re-insert the sheets between
    "start" & "end" and keep the numerical order intact.

    Has anybody got any ideas?

    All suggestions gratefully received

    Regards


    Michael beckinsale






  2. #2
    Nigel
    Guest

    Re: Moving / sorting sheets in VBA

    This will do it for the references you gave.....

    Sub SortSheets()
    Dim xs As Integer
    Application.ScreenUpdating = False
    Sheets("LN1").Move After:=Sheets("start")
    For xs = 1 To 19
    Sheets("LN" & xs + 1).Move After:=Sheets("LN" & xs)
    Next
    Sheets("end").Move After:=Sheets("LN20")
    Application.ScreenUpdating = True
    End Sub

    --
    Cheers
    Nigel



    "Michael Beckinsale" <[email protected]> wrote in message
    news:[email protected]...
    > Hi All,
    >
    > I have a series of identical sheets named LN1, LN2 etc up to LN20. They

    are
    > sandwiched between sheets "start" & "end" and each cell is summed using
    > =SUM(LN1:Ln2!A1) etc.
    >
    > The user has been given the functionality to remove (say LN2, LN3, LN4)

    from
    > the protfolio by moving the sheets outside the "start" & "end" sandwich.
    >
    > The problem l am having is writing some code to re-insert the sheets

    between
    > "start" & "end" and keep the numerical order intact.
    >
    > Has anybody got any ideas?
    >
    > All suggestions gratefully received
    >
    > Regards
    >
    >
    > Michael beckinsale
    >
    >
    >
    >
    >




+ 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