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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You can do that like
VBA Code:
   ShtName = Format(Date, "yy") & DatePart("ww", Date + 7, vbMonday, vbFirstFourDays)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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