ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   One for every month (https://www.excelbanter.com/excel-programming/407886-re-one-every-month.html)

DonV

One for every month
 
After using this code to create a worksheet for each month of the year in an
existing workbook and saving it,

Sub AddSheets()
Dim sh As Worksheet
Dim i As Long


With ActiveWorkbook


Set sh = ActiveSheet
For i = 1 To 12
sh.Copy After:=.Worksheets(.Worksheets.Count)
ActiveSheet.Name = Format(DateSerial(Year(Date), i, 1), "mmmm")
Next i
End With
End Sub


Saving it created a new workbook with the same name but the extension .xlsm
and the Excel icon has a yellow overlay with an exclamation mark. Does this
mean that something is wrong with the workbook?



All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com