Protect a workbook
How to protect an excel workbook structure using Excel or VBA
Review tab > Protect Workbook > Enter password > Click OK > Reenter password > Click OK
1. Select the Review tab. |
2. Click on Protect Workbook in the Protect group. |
3. In the Protect Structure and Windows dialog box enter a password in the Password input box. 4. Check the Structure checkbox. 5. Click OK. |
6. Reenter the password in the Confirm Password dialog box. 7. Click OK. |
METHOD 1. Protect a workbook using VBA
VBA
Sub Protect_Workbook()
'Protect a workbook, using a password
ThisWorkbook.Protect Password:="Pword", Structure:=True
ThisWorkbook.Protect Password:="Pword", Structure:=True
End Sub
ADJUSTABLE PARAMETERS
Password: Enter the password that you want to protect the workbook with by changing "Pword" in the VBA code.
Password: Enter the password that you want to protect the workbook with by changing "Pword" in the VBA code.
ADDITIONAL NOTES
Note 1: This VBA code will protect the same workbook in which it's written in.
Note 1: This VBA code will protect the same workbook in which it's written in.
EXPLANATION
This tutorial shows how to protect a workbook structure which will restrict users to insert, delete, rename, copy, move, color, hide and unhide worksheets by using Excel and VBA methods.
This tutorial provides one Excel method that can be applied to protect a workbook. This is achieved in seven steps.
This tutorial show how using VBA you can protect the same worksheet in which the VBA code is written in.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Protect a single sheet | How to protect a single sheet in a workbook using Excel or VBA | |
Unprotect a single sheet | How to unprotect a single sheet in a workbook using Excel or VBA | |
Protect all sheets at once | How to protect all sheets in a single workbook at once through the use of VBA | |
Unprotect all sheets at once | How to unprotect all protected sheets in a single workbook at once through the use of VBA |