Protect a workbook

How to protect an excel workbook structure using Excel or VBA

METHOD 1. Protect a workbook

EXCEL

Review tab > Protect Workbook > Enter password > Click OK > Reenter password > Click OK

1. Select the Review tab. Select the Review tab

2. Click on Protect Workbook in the Protect group. Click Protect Workbook

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.
Enter Password, check Structure and click OK

6. Reenter the password in the Confirm Password dialog box.
7. Click OK.
Reenter password and 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

End Sub

ADJUSTABLE PARAMETERS
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.

Explanation about how to protect a workbook

EXPLANATION

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
How to protect a single sheet in a workbook using Excel or VBA
How to unprotect a single sheet in a workbook using Excel or VBA
How to protect all sheets in a single workbook at once through the use of VBA
How to unprotect all protected sheets in a single workbook at once through the use of VBA