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" wrote in message
...
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
|