Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error: "Excel encountered an error and had to remove some formatti | Excel Discussion (Misc queries) | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming |