BillPeterson
New Member
- Joined
- Jan 16, 2022
- Messages
- 22
- Office Version
- 365
- Platform
- Windows
I create a new tab every month for keeping track of credit card expenses. I do this by copying the latest sheet, and then manually editing several cells to get ready for the next cycle. Instead of copying the "June" tab and ending up with "June (2)", I'd like it to automatically rename it to "July". I decided to at least make it generic for now, and the code below works, but then of course I have to manually change "XX" to "23" (i.e. current year), and then "xxx" to "Jul" (i.e. current month). Would be great to create a variable for these such that it just extracts the current month and year from a formula like "today()" and then renames the tab to the next month. Any suggestions?
Thanks in advance for your help! You guys are geniuses
VBA Code:
Sheets("CCXXxxx").Select
Sheets("CCXXxxx").Copy Before:=Sheets(1)
Sheets("CCXXxxx (2)").Select
Sheets("CCXXxxx (2)").Name = "CCYYxxx"
Thanks in advance for your help! You guys are geniuses