Protecting Many Worksheets

Written by Allen Wyatt (last updated October 8, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Andre has a workbook that contains 52 worksheets. He would like to protect the worksheets, but not the workbook itself. Currently he individually protects all 52 sheets. He wonders if there is a way to protect them all in one go.

The only way to do this is to use a macro. Fortunately, the macro is quite short:

Sub ProtectAllSheets()
    Dim ws As Worksheet

    For Each ws In Worksheets
        ws.Protect
    Next
End Sub

When you run this macro, all of the worksheets in the workbook are protected, without specifying a password. (This means anyone can easily unprotect them.) If you want to specify a password, then you can do so with an easy modification:

Sub ProtectAllSheets()
    Dim ws As Worksheet

    For Each ws In Worksheets
        ws.Protect Password:="MyPassword"
    Next
End Sub

The password you specify will be used for each of the worksheets, meaning that all of them will use the same password.

You can easily modify these macros to unprotect all your worksheets by simply changing the .Protect method to .Unprotect.

You should also be aware that if your workbook or worksheets utilize some options that preclude worksheet protection (such as sharing), then the macros will generate an error.

An entirely different approach is to use a third-party utility to do the protecting. You can find such utilities with a quick Internet search; an example would be Asap Utilities (https://www.asap-utilities.com).

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7511) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Copying Form Field Contents

Are you developing a form with Word? In some instances it is advantageous to copy whatever is entered in a form field to ...

Discover More

Pulling Access Information into Excel

If you have a lot of data stored in Access databases, you may want to get at that information using Excel. There are a ...

Discover More

Making a Named Range Non-Scrollable

Excel provides a few ways that you can freeze or split what you see in your worksheet. The appropriateness of these tools ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Locking Worksheet Names

Want to stop other people from changing the names of your worksheets? You can provide the desired safeguard by using the ...

Discover More

Forcing a Worksheet to be Protected Again

Excel allows you to protect your worksheets so they can only be changed as you want to have happen. If you unprotect a ...

Discover More

Locking All Non-Empty Cells

Need to make sure that your worksheet is locked, with only the blank cells accessible to editing? You can do this easily ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 6?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.