create and name 12 new sheets in one go?

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I need to create 12 new sheets in a worksheet and label them january to december? Not too bad as a one-off but probably have to it quite often so automation would be handy.

they would be sheets 1 to 12 and there will be a sheet 13 and 14 and , one for data and 2 for summaries but i could put those in front if its easier. he data sheet can have a column with January to December on it.

I was told how do this many years ago but i lost my notes!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
How about
Code:
Sub merlin777()
   Dim i As Long
   
   For i = 12 To 1 Step -1
      Sheets.Add(Sheets(1)).Name = MonthName(i)
   Next i
End Sub
 
Upvote 0
Try:
Code:
Sub CreateMonthSheet()
    Application.ScreenUpdating = False
    Dim x As Long, y As Long
    For x = 1 To 12
        Worksheets.Add after:=Sheets(Sheets.Count)
        ActiveSheet.Name = MonthName(x)
        For y = 1 To 12
            Cells(1, y) = MonthName(y)
        Next y
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try:
Code:
Sub CreateMonthSheet()
    Application.ScreenUpdating = False
    Dim x As Long, y As Long
    For x = 1 To 12
        Worksheets.Add after:=Sheets(Sheets.Count)
        ActiveSheet.Name = MonthName(x)
        For y = 1 To 12
            Cells(1, y) = MonthName(y)
        Next y
    Next x
    Application.ScreenUpdating = True
End Sub

thanks, guys. How do i reference the labels for the sheet tabs in these? They are in the sheet labelled DATA in cells J3 to J14
 
Upvote 0
If you mean you want to add the monthname in J3:J14 try
Code:
Sub merlin777()
   Dim i As Long
   
   For i = 12 To 1 Step -1
      Sheets.Add(Sheets(1)).Name = MonthName(i)
      Sheets("Data").Range("J" & i + 2).Value = MonthName(i)
   Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,377
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top