t0ny84
Board Regular
- Joined
- Jul 6, 2020
- Messages
- 205
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
- Mobile
- Web
I am currently needing to script 12 buttons, one for each month of the year.
Each sheet is number as per the month it is e.g. January is 1 and so on.
I am trying to find a way of condensing the code for each button as I currently have the following setup for each button.
I thought about using a LOOP but as there will be other sheets within the final document I only want to hide the ones selected.
Any help would be appreciated.
Thanks t0ny84
Each sheet is number as per the month it is e.g. January is 1 and so on.
I am trying to find a way of condensing the code for each button as I currently have the following setup for each button.
I thought about using a LOOP but as there will be other sheets within the final document I only want to hide the ones selected.
Any help would be appreciated.
Thanks t0ny84
VBA Code:
Sub NOV11()
Sheets("11").Visible = True
Sheets("11").Range("J1").Select
Sheets("1").Visible = False
Sheets("2").Visible = False
Sheets("3").Visible = False
Sheets("4").Visible = False
Sheets("5").Visible = False
Sheets("6").Visible = False
Sheets("7").Visible = False
Sheets("8").Visible = False
Sheets("9").Visible = False
Sheets("10").Visible = False
Sheets("12").Visible = False
End Sub