![]() |
Protection
Hi, I have a workbook with over 100 sheets in it and each sheet is protected,
at the moment I am unprotecting each sheet one at a time, is there an easyer way to do this, unprotect or protect all the sheets at the same time, so I can make changes to all in one go?. Any ideas. Thanks in advance, Barry. |
Protection
These might help.........(watch out for the word-wrap)
Sub ProtectSheets() Worksheets("sheet1").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="aaa" Worksheets("sheet2").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="bbb" Worksheets("sheet3").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="ccc" End Sub Sub UnProtectSheets() Worksheets("sheet1").Unprotect password:="aaa" Worksheets("sheet2").Unprotect password:="bbb" Worksheets("sheet3").Unprotect password:="ccc" End Sub Vaya con Dios, Chuck, CABGx3 "wildauk" wrote: Hi, I have a workbook with over 100 sheets in it and each sheet is protected, at the moment I am unprotecting each sheet one at a time, is there an easyer way to do this, unprotect or protect all the sheets at the same time, so I can make changes to all in one go?. Any ideas. Thanks in advance, Barry. |
Protection
On Jun 29, 12:00 pm, CLR wrote:
These might help.........(watch out for the word-wrap) Sub ProtectSheets() Worksheets("sheet1").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="aaa" Worksheets("sheet2").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="bbb" Worksheets("sheet3").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:="ccc" End Sub Sub UnProtectSheets() Worksheets("sheet1").Unprotect password:="aaa" Worksheets("sheet2").Unprotect password:="bbb" Worksheets("sheet3").Unprotect password:="ccc" End Sub Vaya con Dios, Chuck, CABGx3 "wildauk" wrote: Hi, I have a workbook with over 100 sheets in it and each sheet is protected, at the moment I am unprotecting each sheet one at a time, is there an easyer way to do this, unprotect or protect all the sheets at the same time, so I can make changes to all in one go?. Any ideas. Thanks in advance, Barry. If the password is the same for every sheet in the worbook: Sub Protect_All() Const STR_PASSWORD As String = "password" Dim sh As Worksheet Application.ScreenUpdating = False For Each sh In Sheets sh.Protect STR_PASSWORD Next sh Application.ScreenUpdating = True End Sub Sub UnProtect_All() Const STR_PASSWORD As String = "password" Dim sh As Worksheet Application.ScreenUpdating = False For Each sh In Sheets sh.Unprotect STR_PASSWORD Next sh Application.ScreenUpdating = True End Sub |
All times are GMT +1. The time now is 05:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com