Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Formulas when Sorting Originalgoth Excel Discussion (Misc queries) 3 December 24th 09 11:41 PM
Moving Formulas when Sorting a table Originalgoth Excel Discussion (Misc queries) 0 December 24th 09 11:05 PM
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Sorting/Moving Data jaroady Excel Worksheet Functions 3 October 5th 07 07:02 PM
Sorting/Moving koba Excel Discussion (Misc queries) 3 February 22nd 06 03:02 AM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"