Protect/Unprotect Multiple Worksheets

Giganews Newsgroups
Subject: Protect/Unprotect Multiple Worksheets
Posted by:  Katherine R
Date: Tue, 9 May 2006

I used the following macro from an earlier posting to protect multiple
worksheets in a workbook and it worked great.  (Thank you Kevin Backmann!!!)

Now I would like a macro to do the reverse - that is unprotect all
worksheets.  I tried the same macro changing every instance of the word
Protect to Unprotect, but that didn't work.  What can I do to make this work?

Thanks.  (I've copied and pasted Kevin's earlier posting below:)


"The following macro cycless through all the worksheets in the active
workbook, protecting them and assigning the password of "Password"

Sub ProtectAll()

    Dim wb As Workbook
    Dim ws As Worksheet

    Set wb = ActiveWorkbook

    For Each ws In wb.Worksheets
        ws.Protect DrawingObjects:=True, _
            Contents:=True, Scenarios:=True, _
    Next ws

    Set wb = Nothing
    Set ws = Nothing

End Sub

Place it in a VBA module by pressing Alt+F11, click INSERT on the menu and
select MODULE.  You can either type the code above or cut and paste it.  To
run the macro select TOOLS on the menu, click MACRO and then select MACROS.
The macro will be in the list of available macros.  You can select it and
then click the RUN command button."