R
Ray A
I am trying to automate the opening of a workbook add 12 sheets and name each
of them for a month of the year.
This is the code and it does not work. Can someone help? Please feel free to
criticize as I am very new to VBA
Sub SheetsPerMonth()
Dim nwb As Workbook
Dim ShinWb As Integer
Dim newShinWb As Integer
Dim a As Integer
ShinWb = Application.SheetsInNewWorkbook
newShinWb = 12
Application.SheetsInNewWorkbook = newShinWb
Set nwb = Workbooks.Add
Application.SheetsInNewWorkbook = ShinWb
For a = 1 To 12
nwb.Sheets(a).Name = Format(DateSerial(2006, a, 1), "mmm")
Next
End Sub
TIA
of them for a month of the year.
This is the code and it does not work. Can someone help? Please feel free to
criticize as I am very new to VBA
Sub SheetsPerMonth()
Dim nwb As Workbook
Dim ShinWb As Integer
Dim newShinWb As Integer
Dim a As Integer
ShinWb = Application.SheetsInNewWorkbook
newShinWb = 12
Application.SheetsInNewWorkbook = newShinWb
Set nwb = Workbooks.Add
Application.SheetsInNewWorkbook = ShinWb
For a = 1 To 12
nwb.Sheets(a).Name = Format(DateSerial(2006, a, 1), "mmm")
Next
End Sub
TIA