rhombus4
Well-known Member
- Joined
- May 26, 2010
- Messages
- 586
- Office Version
- 365
- 2016
- Platform
- Windows
Not sure how 1st line will hide Sheet1 and Sheet3 if they are visible, but the second line won't show them. Also does it make a difference if I uses .Sheets or .Worksheets
ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")).Visible = False 'Works if they are showing
ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")).Visible = True 'Doesn't work
I know I can use code below but thought I could do it in one line
ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")).Visible = False 'Works if they are showing
ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")).Visible = True 'Doesn't work
I know I can use code below but thought I could do it in one line
VBA Code:
Dim sh
For Each sh In Sheets(Array("Sheet1", "Sheet3"))
sh.Visible = True
Next