To demonstrate the methods, we will use a dataset that contains some stores and their incomes, expenses, and profits.
Method 1 – Using the Review Tab to Password-Protect Hidden Sheets in Excel
Steps
- You can hide the worksheet just by right-clicking on it. In our example, we want to hide a sheet named Protect Workbook. When you right-click on the sheet, an options menu will appear. From it, select the Hide option.
- This will hide your sheet in the Excel workbook.
- If your worksheet is not protected with a password, you can unhide the sheet just by right-clicking on it and selecting “Unhide”.
- To protect your worksheet with a password, first you need to hide your sheet using the method just described.
- Then click on the Review tab in the ribbon and select Protect Workbook from the Protect group.
- The Protect Structure and Windows dialog box will open. Set a password and click OK.
- A Confirm Password dialog box will appear. Re-type your password and click OK.
- This will eventually protect your sheet with a password. Now, if you right-click on the sheet, the Hide/Unhide options will not be available in the menu.
- To enable the Unhide option, return to the Review tab in the ribbon and select Protect Workbook from the Protect group.
- The Unprotect Workbook dialog box will appear. Enter your password to unprotect the sheet then click OK.
Read More: How to Protect Excel Sheet with Password
Method 2 – Applying VeryHidden Function to Password-Protect Hidden Sheets
Steps
- Press ‘Alt+F11’ to open the Developer tab. You can also open it by customizing the ribbon.
- In Visual Basic, click the View menu option, and select Project Explorer and Properties Windows respectively.
- Now, in the VBAProject, select the sheet that you want to hide by using VeryHidden.
- The selected sheet’s properties will appear at the bottom. Change the Visible option to xlSheetVeryHidden from the drop-down option.
- This will automatically hide your selected worksheet. But anyone can unhide this with ease. To prevent this, you need to protect the sheet with a password.
- Click the Insert menu option and select Module.
- A blank Module window will appear.
- Click the Tools menu option and select VBAProject Properties.
- The Project Properties dialog box will appear. In it, select the Protection tab.
- In the Lock Project section, check Lock project for viewing.
- Set a password and confirm it by re-typing it.
- Click OK.
- Close Visual Basic.
- Set the Save as type option to Excel Macro-Enabled Workbook and click Save.
- Now, if you open Visual Basic, you will need to enter the password in order to unhide the sheet.
Read More: How to Protect an Excel Sheet Except for Certain Cells
Method 3 – Using Excel VBA Code to Password-Protect Hidden Sheets
Steps
- Press ‘Alt+F11’ to open the Developer tab. You can also open it by customizing the ribbon.
- Click the Insert menu option and select Module.
- A Module code window will appear. Copy the following code and paste it in this window.
Sub Protect_and_HideSheet()
Sheets("VBA").Visible = xlSheetVeryHidden
End Sub
- Close the Visual Basic code window.
- Click the View menu option in the ribbon and select Macros
- A Macro dialog box will appear. Select the Protect_and_HideSheet option under Macro Name and click Run.
- This will automatically hide your sheet from the Excel workbook, without password protection. To add a password, return to Visual Basic.
- Open a Module window.
- Click the Tools menu option and select VBAProject Properties.
- A Project Properties dialog box will appear. Select the Protection tab.
- In the Lock Project section, check Lock project for viewing.
- Set a password and confirm it by re-typing.
- Click OK.
- Close the Visual Basic window.
- Save the workbook as type Excel Macro-Enabled Workbook and click Save.
- Now, if you open the Visual Basic window, your password will be required in order to unhide the sheet.
Download Practice Workbook
Related Articles
- How to Protect Excel Sheet from Viewing Using Password
- Excel VBA to Protect Sheet but Allow to Select Locked Cells
<< Go Back to Protect Excel Sheet | Excel Protect | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!