Vba hide a sheet completely in Excel

For example, I would like to hide Sheet1 (Fig 1). If I right click on Sheet1 and click Hide as in Fig 2, the sheet gets hidden as in Fig 3.

However, when I click on "Unhide" as in Fig 4, "Sheet1" shows up in "Unhide" dialog box. Users can employ this option to access the hidden sheet.

I do not even want to leave a clue regarding hidden sheet as I plan to include configuration information that cannot be altered anytime.

Fig 1

excel vba hide a sheet completely

excel vba hide a sheet completely

excel vba hide a sheet completely

Fig 4

excel vba hide a sheet completely

excel vba hide a sheet completely

To do it in Excel, here is the answer:

a) Click on "Visual Basic" under "Developer". Visual Basic Editor comes up as shown below.

Note: If the Developer tab is missing in Ribbon, you can add it using the Customize Ribbon tab of the Excel Options dialog box.

(File->Options->Customize Ribbon-> under Main tab on the right ensure "Developer" is checked).

excel vba hide a sheet completely

b) Click on the sheet to be hidden (Sheet1). Click on "View" .

excel vba hide a sheet completely

c) In the Properties Window for "Sheet1", set the "Visible" property to "xlSheetVeryHidden". Close the Visual Basic Editor.

excel vba hide a sheet completely

d) When right clicking on Sheet Name, in the menu the Unhide option is greyed out as if there are no sheets hidden. This way there is no access to Sheet1 for end users.

Whenever edits are required for Sheet1, the owner of the sheet can set the visible property to "xlSheetVisible", edit Sheet1 and then reset the property back to "xlSheetVeryHidden" using Visual Basic Editor.

excel vba hide a sheet completely

 

You can find similar Excel Questions and Answer hereunder

1) I am planning to protect my sheet using a password. However, for select cells I would like users to be able to edit the cells. In Excel, how can I achieve that?

2) How can I extract file name from a full path including folder path and file name?

3) Vba clear the contents of an entire sheet in Excel

4) How can I add a WorkSheet and name it as required using VBA?

5) Vba list all files in a folder in Excel

6) Line break in vba message box in Excel

7) How can I get row count of filtered data?

8) How to display messages boxes in VBA with the msgbox function

9) How can I list all files in a folder using VBA?

10) How can I copy and rename a WorkSheet using VBA?

 

Here the previous and next chapter