multiple sheet unprotect

jammoca

Banned
Joined
Nov 6, 2002
Messages
1,100
Is there a way to protect or unprotect multiple sheets at a time.

Currently, I have a wokbook that can have up to 60 sheets and occasionally I might need to unprotect all sheets to make amendments to cells that are protectd.

Unprotecting one sheet at a time is a pain in the rear

Any clues ?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
The download is nice, but if you have to send the document to someone with out it...

I created a use form with a Text box and Enter button on it. Right click on the User Form in the project viewer and add this code to it:
Code:
Private Sub CommandButton1_Click()

'Deactivates the alerts and screen updates
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False

On Error GoTo ERR
Dim wSheet As Worksheet
   For Each wSheet In Worksheets
      If wSheet.ProtectContents = True Then
         wSheet.Unprotect Password:=TextBox1.Text
      Else
         wSheet.Protect Password:=TextBox1.Text
      End If
   Next wSheet
Unload Me
Exit Sub

ERR:
resp = MsgBox("You Entered the wrong password")
Unload Me

End Sub

I then added a module button to run the macro and added this code to run:
Code:
Sub Password()
    UserForm1.Show
End Sub
 
Upvote 0
protecting multiple sheets at once

the asap utility worked fine....now I would like to know if protecting multiple sheets can be done on multiple files/workbooks at the same time.????
 
Upvote 0
Hi There

Try this

Code:
Sub Unprotect()

Dim ws As Worksheet
Dim wb As Workbook
Set wb = ActiveWorkbook
For Each ws In wb.Worksheets
  ws.Protect 
Next ws

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top