Hide all sheets but a selected one which is not the active sheet

gordonc068

New Member
Joined
Feb 8, 2016
Messages
12
Hi all,

IO have a workbook with many sheets, only some of which the end user interacts with. I have created a Landing Page which has buttons that a pushed to reveal the appropriate sheets based on the action the person wants to take with the workbook. In the case that someone selects the wrong button I would like an easy way for them to rehide all the sheets and return to the Landing Page.

I have seen a lot of posts about making everything be hidden except the active sheet but the landing page will never be the active sheet in this case. Can anyone help me with this? The page Name I would like to remain unhidden on the button click is "Welcome Page - Enable Macros".

Thank you much.
Chris
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Try

Code:
Sub HideSheets()
Dim ws As Worksheet
Worksheets("Welcome Page - Enable Macros").Visible = True
For Each ws In Worksheets
    If ws.Name <> "Welcome Page - Enable Macros" Then ws.Visible = False
Next ws
End Sub
 

seattlerose

New Member
Joined
Mar 8, 2012
Messages
23
You can try this it should work

Sub HideAllSheetsBarOne()
Dim sht As Object

For Each sht In Sheets
If sht.Name <> "Welcome Page" Then
sht.Visible = xlSheetHidden
End If
Next sht

End Sub
 

gordonc068

New Member
Joined
Feb 8, 2016
Messages
12
Try

Code:
Sub HideSheets()
Dim ws As Worksheet
Worksheets("Welcome Page - Enable Macros").Visible = True
For Each ws In Worksheets
    If ws.Name <> "Welcome Page - Enable Macros" Then ws.Visible = False
Next ws
End Sub


Worked like a charm, thank you very much.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,921
Members
414,416
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top