Hide/Unhide worksheets help

J

Jeremy Gollehon

Using OfficeXP.
In a fresh workbook from the immediate window...

This works.
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetHidden

This:
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetVisible

gives the following error

Run-time error '1004':
Unable to set the Visible property of the Sheets class

This seems like an easy one, but I haven't been able to find an answer.

Thanks,
-Jeremy
 
R

Ron de Bruin

You can use this Jeremy

Dim sh As Worksheet
For Each sh In Sheets(Array("Sheet1", "Sheet2"))
sh.Visible = True
Next
 
J

Jeremy Gollehon

Thanks for the reply Ron.

So that means there's no way to do it without a loop?
My actual array is much larger.
I wonder why the hide works, but the unhide doesn't?

-Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top