Hello,
I created this macro over a year ago in Excel 365 and it worked up until very recently (also it still works perfectly in Excel 2019). When run it's supposed to copy the "Add New Worksheet" button into the new worksheet it creates however in no longer copies the button (see pictures). I'm an novice with VBA and I was wondering if anyone knows how to fix this so it will copy the button when the file is opened in Excel 265. Thanks.
I created this macro over a year ago in Excel 365 and it worked up until very recently (also it still works perfectly in Excel 2019). When run it's supposed to copy the "Add New Worksheet" button into the new worksheet it creates however in no longer copies the button (see pictures). I'm an novice with VBA and I was wondering if anyone knows how to fix this so it will copy the button when the file is opened in Excel 265. Thanks.
VBA Code:
Sub AddSheets_TodayDate()
'Updateby20140717
Dim szTodayDate As String
szTodayDate = Format(Date, "mmmmdd")
On Error GoTo MakeSheet
Sheets(szTodayDate).Activate
Exit Sub
MakeSheet:
Sheets.Add , Worksheets(Worksheets.Count)
ActiveSheet.Name = szTodayDate
Sheets("October02").Range("A1:Z100").Copy Destination:=Worksheets(Worksheets.Count).Range("A1")
Sheets("October02").Select
Cells.Select
Selection.Copy
Range("C13").Select
Sheets(Worksheets.Count).Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("C4:F100").Select
Selection.ClearContents
Range("R4").Select
Selection.ClearContents
Range("H4:O100").Select
Selection.ClearContents
ActiveSheet.Protect "toby", True, True
Rows("4:4").Select
ActiveWindow.FreezePanes = True
End Sub