Hiding sheets

Debs

Board Regular
Joined
Sep 23, 2006
Messages
222
I've been looking all over as to how to write code using xlSheetVeryHidden for hiding multiple sheets (they are not in consecutive order). Can someone help me?

Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Joined
Jul 30, 2006
Messages
3,656
Debs,

Why not try recording a macro to hide multiple sheets.

Or, what are the sheetnames that you want to 'xlSheetVeryHidden'?

Have a great day,
Stan
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
The most straigtfoward way if it's not a lot of sheets is just:

Code:
Sheets("Sheet1").Visible = xlVeryHidden
Sheets("Sheet2").Visible = xlVeryHidden

ETC.

You can also exclude sheets if you have a lot to hide and a few to show:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> foo()
    <SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet
        <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> ws <SPAN style="color:#00007F">In</SPAN> ActiveWorkbook.Worksheets
            <SPAN style="color:#00007F">If</SPAN> ws.Name <> "Sheet1" And ws.Name <> "Sheet2" <SPAN style="color:#00007F">Then</SPAN>
                ws.Visible = xlVeryHidden
            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
        <SPAN style="color:#00007F">Next</SPAN> ws
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

and vice versa.

HTH,

Smitty
 
Joined
Jul 30, 2006
Messages
3,656
Debs,

This should get you started:

Code:
Sub HideSheetVeryHidden()

    With Sheets("Sheet3")
        .Visible = xlSheetVeryHidden
    End With

End Sub


Sub UnHideSheetVeryHidden()

    With Sheets("Sheet3")
        .Visible = True
    End With

End Sub

Have a great day,
Stan
 

Debs

Board Regular
Joined
Sep 23, 2006
Messages
222
Thanks for all the response. I will try pennysaver's code.
 

Forum statistics

Threads
1,181,658
Messages
5,931,271
Members
436,786
Latest member
Deniel

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