Efficiently Protect/Unprotect Multiple Sheets in Excel with VBA
Efficiently Protect/Unprotect Multiple Sheets in Excel with VBA
Written By: Ada Codewell – AI Specialist & Software Engineer at Gray Technical.
Are you struggling to protect or unprotect multiple sheets in an Excel workbook? This is a common challenge, especially when dealing with large workbooks containing many worksheets. In this article, we’ll explore why protecting/unprotecting all sheets can be tricky and provide step-by-step solutions using VBA (Visual Basic for Applications). We’ll also look at how tools like CelTools can streamline the process.
The Challenge of Protecting/Unprotecting Multiple Sheets in Excel
When working with large workbooks that have many sheets, manually protecting or unprotecting each sheet is time-consuming and error-prone. This problem becomes even more challenging when you need to frequently switch between protected and unprotected states for editing purposes.
Why It Happens?
The primary reason this task can be cumbersome is that Excel doesn’t provide a built-in feature to protect or unprotect all sheets at once. Each sheet must be individually selected, which becomes impractical as the number of sheets grows.
Step-by-Step Solution: Using VBA for Sheet Protection/Unprotection
The most efficient way to handle this task is by using a simple VBA macro that can loop through all worksheets in your workbook and apply or remove protection as needed. Here’s how you can do it:
Step 1: Open the Visual Basic Editor (VBE)
Press ALT + F11 to open the VBA editor.

Step 2: Insert a New Module
In the VBA editor, go to Insert > Module. This will create a new module where you can write your macro.
Step 3: Write the Protection/Unprotection Macro Code
Copy and paste this code into the newly created module:
Sub ProtectAllSheets()
Dim ws As Worksheet
Dim password As String
' Set your desired password here
password = "YourPassword"
For Each ws In ThisWorkbook.Worksheets
If Not ws.ProtectContents Then
ws.Protect Password:=password, UserInterfaceOnly:=True
End If
Next ws
End Sub
To unprotect all sheets, use this code:
Sub UnprotectAllSheets()
Dim ws As Worksheet
Dim password As String
' Set your desired password here (must match the one used for protection)
password = "YourPassword"
For Each ws In ThisWorkbook.Worksheets
If ws.ProtectContents Then
ws.Unprotect Password:=password
End If
Next ws
End Sub
Step 4: Run Your Macro
Close the VBA editor and return to Excel. Press ALT + F8, select your macro (either ProtectAllSheets or UnprotectAllSheets), and click “Run”.

Advanced Variation: Using CelTools for Enhanced Functionality
While the VBA solution works well, tools like CelTools can offer even more functionality and ease of use. With CelTools, you get 70+ extra Excel features that simplify tasks such as protecting/unprotecting multiple sheets.
Why Use CelTools?
- Ease of use: No need to write or understand VBA code.
- Time-saving: Perform complex tasks with a single click.
- Consistency and reliability: Reduce the risk of errors compared to manual methods.
Avoiding Common Mistakes When Protecting/Unprotecting Sheets
Here are some common pitfalls when working with sheet protection in Excel:
- Forgetting the password: Always document or remember the passwords used for protecting sheets.
- Inconsistent protection settings: Ensure all protected sheets use the same password and protection level to avoid confusion.
- Avoiding unnecessary protections: Only protect cells that need it, as over-protecting can hinder productivity.
Technical Summary: Combining Manual Skills with Specialized Tools
In this article, we’ve explored the challenges of protecting and unprotecting multiple sheets in Excel. By using VBA macros or tools like CelTools, you can significantly streamline these tasks.
While manual methods provide a good understanding of how things work under the hood, specialized tools offer enhanced functionality that saves time and reduces errors. For professionals dealing with large-scale data protection needs, combining both approaches provides the most robust solution.
Written By: Ada Codewell – AI Specialist & Software Engineer at Gray Technical.






















