danbates77
New Member
- Joined
- Jan 10, 2017
- Messages
- 36
- Office Version
- 2016
Hi,
I have found a code that can create a whole months worth of worksheets/tabs with the dates of the month in thanks to @My Aswer Is This
Here is the code:
If possible I would like to be able to alter this code so when it creates the new worksheets/tabs it creates 2 sheets/tabs per date and adds DAYS & NIGHTS in the name.
Example:
01/01/2021 - DAYS
01/01/2021 - NIGHTS
02/01/2021 - DAYS
02/01/2021 - NIGHTS and so on.
Any help would be appreciated if it's possible.
Thanks
Dan
I have found a code that can create a whole months worth of worksheets/tabs with the dates of the month in thanks to @My Aswer Is This
Here is the code:
VBA Code:
Sub Add_Sheet()
Application.ScreenUpdating = False
Dim ans As Date
Dim i As Long
On Error GoTo M
ans = InputBox("Enter Start Date") 'Range("A1").Value
For i = 1 To 31
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(DateAdd("d", i - 1, ans), "dd/mm/yyyy")
Next
Sheets("Master").Activate
Application.ScreenUpdating = True
Exit Sub
M:
MsgBox "Improper date entered in InputBox"
Application.ScreenUpdating = True
End Sub
If possible I would like to be able to alter this code so when it creates the new worksheets/tabs it creates 2 sheets/tabs per date and adds DAYS & NIGHTS in the name.
Example:
01/01/2021 - DAYS
01/01/2021 - NIGHTS
02/01/2021 - DAYS
02/01/2021 - NIGHTS and so on.
Any help would be appreciated if it's possible.
Thanks
Dan