Copy existing worksheet to new worksheet for each day of the month

mlc37444

New Member
Joined
Jul 1, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have an existing template in a worksheet, and I would like to copy that worksheet to a new worksheet for each day of the current month. Each sheet name can be some form of the date, ie "Jul-01, Jul-02, Jul-03" and so on. I've tried a couple different macros but none worked quite right. Could anyone help?

Thank you!
Maggie
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try this macro. The template worksheet is named "Template" in the code - change this as required.

VBA Code:
Public Sub Add_Daily_Sheets()

    Dim d As Date
    
    Application.ScreenUpdating = False
    With ThisWorkbook.Worksheets("Template")  '<----- Name of 'template' worksheet
        For d = DateSerial(Year(Date), Month(Date), Day(Date)) To DateSerial(Year(Date), Month(Date) + 1, 0)
            .Copy After:=Worksheets(Worksheets.Count)
            ActiveSheet.Name = Format(d, "Mmm-dd")
        Next
        .Activate
    End With
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
This worked! Amazing, thank you. Is there any possible way to exclude weekend dates?
 
Upvote 0
Actually, sorry - this created the tabs, but it did not copy my template sheet. It is just a 31 empty sheets for July.
 
Upvote 0
Is there any possible way to exclude weekend dates?

Add this If ... End If clause:

VBA Code:
            If Weekday(d) <> vbSaturday And Weekday(d) <> vbSunday Then
                .Copy After:=Worksheets(Worksheets.Count)
                ActiveSheet.Name = Format(d, "Mmm-dd")
            End If

this created the tabs, but it did not copy my template sheet. It is just a 31 empty sheets for July.

Strange. It should copy everything in the "Template" sheet to the new sheets. If the "Template" sheet is empty the new sheets will be empty.
 
Upvote 0

Forum statistics

Threads
1,223,964
Messages
6,175,659
Members
452,666
Latest member
AllexDee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top