Hide a Sheet Q

S

Sean

I thought the XLVeryhidden function hides a sheet from been unhidden
via Format-Sheet-Unhide and could only be unhidden via code.

Does the Workbook or Sheet have to be protected also?

Thanks
 
N

NickHK

Sean,
With this code and no Protection:

Private Sub CommandButton1_Click()
Worksheets(2).Visible = xlVeryHidden
Worksheets(3).Visible = xlHidden
End Sub

I only see Worksheet 3 in the list of Format>Sheet>Unhide.

I the use run suitable code, then can unhide Worksheet 3 though.

NickHK
 
N

NickHK

That should read:
"If the user runs suitable code, they can unhide Worksheet 2 though."

NickHK
 
S

Sean

Thanks Nick

I had this code for Worksheet open

Worksheets(1).Visible = False

Having already xlVeryhidden all sheets except for one when closing.
When I opened the worksheet was not aware that the above would overide
and hence not be visible but show the sheet in Format-Sheet-Unhide
 
N

NickHK

Sean,
Checking the values of the settings in the Immediate window gives:

?xlsheethidden
0
?xlsheetveryhidden
2
?xlSheetVisible
-1

So you can see the 2 lines of code are exactly the same:
Worksheets(1).Visible = False
Worksheets(1).Visible = xlSheetHidden

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top