Macro as make a copy to a new sheet and rename it

Navy36

New Member
Joined
Oct 9, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi
I looking for help with macro. I want a macro as make a knew sheet and rename it to current date and the knew sheet must make a copy of a master sheet.

Maybe my code is a good start?

Sub AddSheets_TodayDate()
Dim szTodayDate As String
szTodayDate = Format(Date, "mmm-dd-yyyy")
On Error GoTo MakeSheet
Sheets(szTodayDate).Activate
Exit Sub
MakeSheet:
Sheets.Add , Worksheets(Worksheets.Count)
ActiveSheet.Name = szTodayDate
End Sub

I need help ;)
 
How about
VBA Code:
Sub Navy()
   Dim ShtName As String
  
   ShtName = Format(Date, "mmm-dd-yyyy")
   If Evaluate("isref('" & ShtName & "'!A1)") Then
      Sheets(ShtName).Activate
   Else
      Sheets("Master").Copy , Sheets(Sheets.Count)
      ActiveSheet.Name = ShtName
   End If
End Sub
Hi again ;)
I've new question about this code..... Is't possible to rebuild this so when i run this macro it do the same but they rename the sheet to next week number or year and week (like this 2142) ? ;)
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You can do that like
VBA Code:
   ShtName = Format(Date, "yy") & DatePart("ww", Date + 7, vbMonday, vbFirstFourDays)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

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