Forum Discussion
ksmith
Oct 20, 2020Brass Contributor
Macro for naming sequential worksheets
I often have to create a Yearly workbook with worksheet tabs containing the names of each of the 12 consecutive months. Is there a way to create a macro to automatically do this?
13 Replies
You could create such a workbook manually, then save it as a template (.xltx).
You can then double-click the template to create a new copy of it.
If you prefer a macro:
Sub CreateYearly() Dim wbk As Workbook Dim wsh As Worksheet Dim i As Long Application.ScreenUpdating = False Set wbk = Workbooks.Add(Template:=xlWBATWorksheet) Set wsh = wbk.Worksheets(1) wsh.Name = MonthName(12) For i = 11 To 1 Step -1 Set wsh = wbk.Worksheets.Add(Before:=wsh) wsh.Name = MonthName(i) Next i Application.ScreenUpdating = True End Sub