Protect a single sheet
How to protect a single sheet in a workbook using Excel or VBA
Select sheet > Review tab > Protect Sheet > Enter password > Check Protect worksheet and contents of locked cells > Select components that users can access > Click OK > Reenter password > Click OK
1. Select the worksheet that you want to protect. Note: in this example we are protecting Sheet2. |
2. Select the Review tab. |
3. Click on Protect Sheet in the Protect group. |
4. In the Protect Sheet dialog box enter a password in the Password to unprotect sheet input box. 5. Check Protect worksheet and contents of locked cells. 6. Select the components of worksheet that you want to allow users access. 7. Click OK. |
8. Reenter the password in the Confirm Password dialog box. 9. Click OK. |
METHOD 1. Protect a sheet using VBA
VBA
Sub Protect_Sheet()
'Protect a sheet, using a password
Sheets("Sheet2").Protect Password:="Pword"
Sheets("Sheet2").Protect Password:="Pword"
End Sub
ADJUSTABLE PARAMETERS
Sheet to Protect: Select the sheet which you want to protect by changing the Sheet2 sheet name in the VBA code.
Sheet to Protect: Select the sheet which you want to protect by changing the Sheet2 sheet name in the VBA code.
EXPLANATION
This tutorial shows how to protect a single sheet in a workbook by using Excel and VBA methods.
This tutorial provides one Excel method that can be applied to protect a single sheet. This is achieved in nine steps.
Using VBA you can protect a specific sheet by defining the sheet and using the Protect and Password functions.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
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 |