cadandcode
Board Regular
- Joined
- Jan 21, 2023
- Messages
- 125
- Office Version
- 2019
- Platform
- Windows
- Mobile
I'm trying to manage daily reports. Im doing repetitive things such copy sheet and rename it.
Sheet names are dates. Like 02/03/23 (dd,mm,yy)
I want to add new sheet by copying last sheet and rename it adding 1 day to date like 02/03/23 to 03/03/23.
I tried to do it by macro but it renames new sheet adding (2) at the end of sheet name. It names 02/03/23 (2) but I need 03/03/23
Here is my macro I tried;
Sheet names are dates. Like 02/03/23 (dd,mm,yy)
I want to add new sheet by copying last sheet and rename it adding 1 day to date like 02/03/23 to 03/03/23.
I tried to do it by macro but it renames new sheet adding (2) at the end of sheet name. It names 02/03/23 (2) but I need 03/03/23
Here is my macro I tried;
VBA Code:
Sub CopySheetDateYesterday()
'
' CopySheetDateYesterday Makro
'
'
Sheets("02.02.23").Select
Sheets("02.02.23").Copy After:=Sheets(1)
Sheets("02.02.23 (2)").Select
Sheets("02.02.23 (2)").Name = "03.02.23"
Range("B40").Select
ActiveCell.FormulaR1C1 = "2/2/2023"
Range("B41").Select
End Sub