hi everyone,
i want to create a module to speed up tab naming which I normally remake them by hand, my tabs the day of the week month day and year for example my tabs would be (Mon March 1, 2021) and next would be the next day and so on.
i found one module from TotallyConfused in a old post which has what i want but not the week if any one can help or explain how to add it to this would be grateful.
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 WK As Integer
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 = WK & 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
i want to create a module to speed up tab naming which I normally remake them by hand, my tabs the day of the week month day and year for example my tabs would be (Mon March 1, 2021) and next would be the next day and so on.
i found one module from TotallyConfused in a old post which has what i want but not the week if any one can help or explain how to add it to this would be grateful.
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 WK As Integer
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 = WK & 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