Adding new worksheet BEFORE 1st worksheet

  • Thread starter Thread starter Rob P
  • Start date Start date
R

Rob P

I am calling several macros

the last of which is:

Sub summary()
Sheets.Add.Name = "1 day moves"
Sheets.Add.Name = "3 day moves"
End Sub

this inserts the 2 new worksheets BEFORE the very last sheet

how can I insert these BEFORE a specific worksheet called "template"

thank you
Rob
 
I am calling several macros

the last of which is:

          Sub summary()
              Sheets.Add.Name = "1 day moves"
              Sheets.Add.Name = "3 day moves"
          End Sub

this inserts the 2 new worksheets BEFORE the very last sheet

how can I insert these BEFORE a specific worksheet called "template"

thank you
Rob

Try this...

Sub summary()
Sheets.Add.Name = "1 day moves"
Sheets.Add.Name = "3 day moves"
Sheets("1 day moves").Move Sheets("template")
Sheets("3 day moves").Move Sheets("template")
End Sub
 
Sorry I thought you are looking to insert as the first sheet. The below will
insert before 'Template'

Worksheets.Add(Before:=Worksheets(Sheets("template").Index)).Name = "MySheet1"
 
Back
Top