Tab's

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

Hi,

I created a spreadsheet (excel 2003?) with January to December tabs. I did
them one at a time. Is there a short cut to add all at once i.e Jan - Dec
or 1 to 10 etc....

Thanks
Bruce
 
Sub AddMonthSheets()
For i = 1 To 12
Sheets.Add after:=Sheets(Sheets.Count)
'ActiveSheet.Name = i
'or
ActiveSheet.Name = _
Format(DateSerial(Year(Date), i, 1), "MMM")
Next i
End Sub
 
Hi,

I created a spreadsheet (excel 2003?) with January to December tabs. I did
them one at a time. Is there a short cut to add all at once i.e Jan - Dec
or 1 to 10 etc....

Do you mean in a worksheet formula, or in VBA. Don Guillett gave you
the VBA solution, but the worksheet solution is

=sum(Jan:Dec!C17)

Assuming your sheets are in order, that will add cell C17 from all
twelve months.

For more, see "3-D cell reference" in Excel's help.
 
all at once i.e Jan - Dec
ActiveSheet.Name = _
Format(DateSerial(Year(Date), i, 1), "MMM")

Here's a slight variation:

Sub AddMonthSheets()
Dim M As Long
For M = 1 To 12
Sheets.Add(after:=Worksheets(Sheets.Count)).Name = MonthName(M, True)
Next M
End Sub

= = = = = = =
Dana DeLouis
 
Back
Top