Hide range of worksheets in a workbook

  • Thread starter Thread starter AuthorizedUserPF
  • Start date Start date
A

AuthorizedUserPF

Good afternoon;

I have two macros that I created some time ago that Hides and Unhides
specific sheets in a workbook.

I want to be able to hid and unhide all the sheets in a workbook, regardless
of what they are named.

The line I am having trouble with is:

Sheets("Sheet1").Visible = xlVeryHidden

What can I replace "Sheet1" with to make all the sheets, regardless of their
name very hidden?

Thanks and regards
Phil
 
Try this but note that there must be one visible worksheet; change "Sheet1"
to suit.

For Each ws In Worksheets
If ws.Name <> "Sheet1" Then
ws.Visible = False ( or xlVeryHidden)
End If
Next

HTH
 
I think that should be

For Each ws In Activeworkbook.Worksheets
If ws.Name <> "Sheet1" Then
ws.Visible = xlVeryHidden
End If
Next


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top