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 ;)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
So you want to make a copy of the sheet named ??
And name the new sheet ??
 
Upvote 0
So you want to make a copy of the sheet named
I want the knew sheet should be a copy from a another sheet. It should be a daily document and every new day it should be a copy from a master sheet, but if it same date as before nothing should happen
 
Upvote 0
Try this:
VBA Code:
Sub Copy_Sheet()
'Modified 10/9/2021  7:22:55 AM  EDT
Application.ScreenUpdating = False
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Bravo" & Format(Date, "mmm-dd-yyyy")
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try this:
VBA Code:
Sub Copy_Sheet()
'Modified 10/9/2021  7:22:55 AM  EDT
Application.ScreenUpdating = False
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Bravo" & Format(Date, "mmm-dd-yyyy")
Application.ScreenUpdating = True
End Sub
I have tried a lot of codes... Your code works great, but if i run the macro to times it going to be error. Do you think if it is running same date nothing wont to happen? or it only open the sheet we already have maked?
 
Upvote 0
Try this:
VBA Code:
Sub Copy_Sheet()
'Modified 10/9/2021  7:37:45 AM  EDT
Application.ScreenUpdating = False
On Error GoTo M
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Bravo" & Format(Date, "mmm-dd-yyyy")
Exit Sub
M:
MsgBox "That sheet already exist"
ActiveSheet.Delete
Application.ScreenUpdating = True
End Sub
 
Upvote 0
You still have never told me the name of the sheet you want copied and how you want the new sheet named I guess this is what you want:
VBA Code:
Sub Copy_Sheet()
'Modified 10/9/2021  7:37:45 AM  EDT
Application.ScreenUpdating = False
On Error GoTo M
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Master" & Format(Date, "mmm-dd-yyyy")
Exit Sub
M:
MsgBox "That sheet already exist"
ActiveSheet.Delete
Application.ScreenUpdating = True
End Sub
 
Upvote 0
it is better but on error i want it goto the current date sheet and no messeges boxes
 
Upvote 0
I can do no more for you when your not giving me the information I'm asking for.
Like what is the name of the sheet your copying.

And how am I suppose to know what the current date sheet is?
Is the current date sheet the one your copying?
 
Upvote 0

Forum statistics

Threads
1,215,437
Messages
6,124,871
Members
449,192
Latest member
MoonDancer

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