mushkapush
New Member
- Joined
- Jan 21, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi there,
I am a total noob at this so be gentle!
I have a sheet that is essentially a calendar, with 1 week per sheet (i.e. Sheet 1 = 1st Jan, Sheet 2 = 8th Jan and so on). I am trying to make it so that all I have to do is type in to one cell the date I want the calendar to start from, and then each sheet and sheet name will automatically change accordingly. I've got the sheet contents auto-populating fine with some basic formulas, it's the sheet names I'm struggling with.
I have successfully managed to get the 1st sheet to rename itself based on the cell value of B3; when I type "1st Jan" into B3, the sheet name changes to "1st Jan", all good! I now need the 2nd sheet to rename itself based on the cell value of B3 in the 1st sheet also and then add 7 days (so B3+7), and then again the 3rd sheet, and so on. So that all I have to do is type the name into B3 in the 1st sheet and the rest will rename automatically. I am struggling to work out how to do this because by its very nature the sheet name of the 1st sheet isn't initially known, so I don't have a sheet name to reference in the VBA for the remaining sheets.
The macro I'm using for rename sheet 1 is below:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Name = Format(Range("B3").Value, "dd-mmm")
If Target = "" Then Exit Sub
Exit Sub
End Sub
Hoping this makes sense as I'm somewhat out of my depth!
Thanks!
I am a total noob at this so be gentle!
I have a sheet that is essentially a calendar, with 1 week per sheet (i.e. Sheet 1 = 1st Jan, Sheet 2 = 8th Jan and so on). I am trying to make it so that all I have to do is type in to one cell the date I want the calendar to start from, and then each sheet and sheet name will automatically change accordingly. I've got the sheet contents auto-populating fine with some basic formulas, it's the sheet names I'm struggling with.
I have successfully managed to get the 1st sheet to rename itself based on the cell value of B3; when I type "1st Jan" into B3, the sheet name changes to "1st Jan", all good! I now need the 2nd sheet to rename itself based on the cell value of B3 in the 1st sheet also and then add 7 days (so B3+7), and then again the 3rd sheet, and so on. So that all I have to do is type the name into B3 in the 1st sheet and the rest will rename automatically. I am struggling to work out how to do this because by its very nature the sheet name of the 1st sheet isn't initially known, so I don't have a sheet name to reference in the VBA for the remaining sheets.
The macro I'm using for rename sheet 1 is below:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Name = Format(Range("B3").Value, "dd-mmm")
If Target = "" Then Exit Sub
Exit Sub
End Sub
Hoping this makes sense as I'm somewhat out of my depth!
Thanks!