Hi,
I'm hoping for some help please.
I've just started writing the code below to unhide worksheets based on a value in a single cell. The code works but I have lots of sheets to unhide - my cases go up to 27 which will unhide 27 sheets so a lot of typing!
Please could somebody advise if there is a way to unhide multiple sheets in 1 line of code e.g. could case 3 below be converted to something along the lines of Worksheets("1,2,3").Visible = True?
Thank you,
Iain
I'm hoping for some help please.
I've just started writing the code below to unhide worksheets based on a value in a single cell. The code works but I have lots of sheets to unhide - my cases go up to 27 which will unhide 27 sheets so a lot of typing!
Please could somebody advise if there is a way to unhide multiple sheets in 1 line of code e.g. could case 3 below be converted to something along the lines of Worksheets("1,2,3").Visible = True?
Thank you,
Iain
VBA Code:
Sub macro10()
Select Case Worksheets("INSTRUCTIONS").Range("G10").Value
Case "1"
Worksheets("1").Visible = True
Case "2"
Worksheets("1").Visible = True
Worksheets("2").Visible = True
Case "3"
Worksheets("1").Visible = True
Worksheets("2").Visible = True
Worksheets("3").Visible = True
End Select
End Sub