#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Protection HDV Excel Discussion (Misc queries) 1 March 25th 06 07:46 PM
Protection mac Excel Worksheet Functions 2 April 25th 05 06:18 PM
Another Protection Q JudithJubilee Excel Discussion (Misc queries) 2 March 4th 05 05:50 AM


All times are GMT +1. The time now is 07:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"