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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

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
Back
Top