Also_Confused
New Member
- Joined
- Jul 29, 2021
- Messages
- 1
- Office Version
- 365
- 2019
- 2016
Hi All,
I used the code below, from an old thread, which creates a macro that:
*creates a copy of the "Master" sheet for each day of a single month
*names each tab with a specific day (Aug-01-2021, Aug-02-2021, Aug-03-2021, etc)
If possible, I would like to add the 2 items below to this Macro, but I have no idea how to do this.
#1. Within the "Master" I also have a specific cell, B3, that has the date. I would like to add to the macro, for this cell to match the date on the tab name in each added sheet. All other cells in the Master sheet should remain identical in added sheets.
#2. Then, create a button on the master, that allows for 1 click to complete the macro.
Can #1 and #2 be added to the macro below so there is only 1 macro in the sheet?
**disclaimer.... This is the first time I have ever worked within the developer tab in Excel, and therefore the first time I have ever worked with a Macro.
Thanks so much in advance for any assistance!!
Also_Confused
I used the code below, from an old thread, which creates a macro that:
*creates a copy of the "Master" sheet for each day of a single month
*names each tab with a specific day (Aug-01-2021, Aug-02-2021, Aug-03-2021, etc)
If possible, I would like to add the 2 items below to this Macro, but I have no idea how to do this.
#1. Within the "Master" I also have a specific cell, B3, that has the date. I would like to add to the macro, for this cell to match the date on the tab name in each added sheet. All other cells in the Master sheet should remain identical in added sheets.
#2. Then, create a button on the master, that allows for 1 click to complete the macro.
Can #1 and #2 be added to the macro below so there is only 1 macro in the sheet?
**disclaimer.... This is the first time I have ever worked within the developer tab in Excel, and therefore the first time I have ever worked with a Macro.
VBA Code:
Sub CreateMonthlySheets()
'Creates a copy of "Master" sheet for number of days you specify
'It then renames the copies according to the date. e.g. Jan 01 2017
Application.ScreenUpdating = False
Dim Ans As Date
Dim MO As Integer
Dim DA As Integer
Dim YR As Integer
Dim X As Integer
X = 0
On Error GoTo M
MO = InputBox("Enter month number: (1 - 12)")
DA = InputBox("Enter number of days in the month: (28 - 31)")
YR = InputBox("Enter year: (2017)")
Ans = MO & "/" & 1 & "/" & YR
For X = 1 To DA
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(DateAdd("d", X - 1, Ans), "MMM dd yyyy")
Next
Sheets("Master").Activate
Application.ScreenUpdating = True
Exit Sub
M:
MsgBox "You made an invalid entry."
Application.ScreenUpdating = True
End Sub
Thanks so much in advance for any assistance!!
Also_Confused
Last edited by a moderator: