Hide range of worksheets in a workbook
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 |
Hide range of worksheets in a workbook
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 "AuthorizedUserPF" wrote: 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 |
Hide range of worksheets in a workbook
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) "Toppers" wrote in message ... 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 "AuthorizedUserPF" wrote: 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 |
All times are GMT +1. The time now is 03:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com