Automating create copy of current tab with date

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
785
Office Version
  1. 365
Platform
  1. Windows
Hi,
i have a current tab with mondays date in cell A1 like 13/08/18 and the tab is named 13.08.18

how can i with VBA, create a copy into new tabs for every week in the year (or a specified amount)

i.e next tab will have 20/08/2018 with tab name 20.08.18

thanks for any help
 
If you wanted to keep adding more sheets at a later time. And all your sheets had dates for sheet names you could use this script. It looks at the last sheet in the workbook and uses it's date name as a starting point to add more sheet names giving them a date 7 days greater then the last sheets name.

Code:
Sub Sheet_Copy()
'Modified  8/15/2018  10:55:32 PM  EDT
Application.ScreenUpdating = False
Dim ans As Variant
Dim sn As String
sn = Sheets(Sheets.Count).Name
ans = InputBox("Make how many copies")
If ans = "" Then MsgBox "You did not enter a number": Exit Sub
    For i = 1 To ans
        Sheets(sn).Copy after:=Sheets(Sheets.Count)
        ActiveSheet.Name = Format(DateAdd("d", i * 7, sn), "DD-MM-YYYY")
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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