Unprotect and protect sheets all at once

Eddie G.

Board Regular
Joined
Feb 27, 2002
Messages
98
i have a workbook with 50 sheets that I need to unprotect or protect all at once (no passwords involved), instead of this nonsense: sheet1.unprotect 50 times. can someone help?? thanks.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Private Sub Protect_All_Sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect 'change Protect to Unprotect to Unprotect all Worksheets
Next ws
End Sub
 
Upvote 0
Try the following:

Sub unlockall()

For i = 1 To Worksheets.Count
Worksheets(i).Activate
ActiveSheet.Unprotect

Next i

End Sub


If you do want to go down the password route:

Sub unlockall()

For i = 1 To Worksheets.Count

Worksheets(i).Activate
ActiveSheet.Unprotect "My Password"

Next i

End Sub
 
Upvote 0
Try the following:

Sub unlockall()

For i = 1 To Worksheets.Count
Worksheets(i).Activate
ActiveSheet.Unprotect

Next i

End Sub


If you do want to go down the password route:

Sub unlockall()

For i = 1 To Worksheets.Count

Worksheets(i).Activate
ActiveSheet.Unprotect "My Password"

Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,247
Members
448,879
Latest member
oksanana

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