Protect-Unprotect all the sheets
Gary
Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Protect Password:="justme"
Next n
Application.ScreenUpdating = True
End Sub
Sub Protect_Selected_Sheets()
Set MySheets = ActiveWindow.SelectedSheets
For Each WS In MySheets
WS.Select
WS.Protect Password:="justme"
Next WS
End Sub
In both Subs change WS.Protect to WS.Unprotect to go the other way.
Gord Dibben MS Excel MVP
On Fri, 23 Feb 2007 16:52:39 -0700, "Gary" wrote:
Hi Mike,
i copied and pasted this but it's not working.
"Mike" wrote in message
...
provided all sheets have the same password, this will do
Sub dontblameme()
Dim sht As Worksheet
For Each sht In Sheets
Name = sht.Name
Worksheets(Name).Select
ActiveSheet.Unprotect Password:="YOURPASSWORD"
Next sht
End Sub
"Gary" wrote:
Hi All,
If i have a workbook with 15 or more sheets and i want to protect /
unprotect all of them together. How do I do it? going to every sheet and
doing it takes a lot of time....am sure there must be a way of doing
that.
Thanks
gary
|