Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Protect multiple sheets in one time

I am using work books containing 50+ sheets and all of the sheets have to be
protected to prevent users from changing or damaging formula's in locked
cells. I did not find a method yet to protect more than 1 sheet at the same
time (using the same password). Does anyone of you know a way to handle this?

Many thanks in advance,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Protect multiple sheets in one time

Henk, here is one way,

Sub protect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect password:="123"
Next ws
End Sub


And to unprotect

Sub unprotect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect password:="123"
Next ws
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Henk Frigge" <Henk wrote in message
...
I am using work books containing 50+ sheets and all of the sheets have to

be
protected to prevent users from changing or damaging formula's in locked
cells. I did not find a method yet to protect more than 1 sheet at the

same
time (using the same password). Does anyone of you know a way to handle

this?

Many thanks in advance,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Protect multiple sheets in one time

tHENKs Paul!

Working great!

"Paul B" wrote:

Henk, here is one way,

Sub protect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect password:="123"
Next ws
End Sub


And to unprotect

Sub unprotect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect password:="123"
Next ws
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Henk Frigge" <Henk wrote in message
...
I am using work books containing 50+ sheets and all of the sheets have to

be
protected to prevent users from changing or damaging formula's in locked
cells. I did not find a method yet to protect more than 1 sheet at the

same
time (using the same password). Does anyone of you know a way to handle

this?

Many thanks in advance,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Protect multiple sheets in one time


Good morning Henk Frigge

This code will do what you're asking.

Sub ProtSheets()
For Each WkSht In Worksheets
WkSht.Protect password:="password"
Next WkSht
End Sub

Note that for simplicity I have omitted some of the optional settings
that can be used in th third "Protect" line. (In XL2000
(DrawingObjects:=True, Contents:=True, Scenarios:=True but in XL
2002/2003 around a dozen other optional settings)

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=383063

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Protect multiple sheets in one time

tHENKs Dominic

This one is working perfectly too!

"dominicb" wrote:


Good morning Henk Frigge

This code will do what you're asking.

Sub ProtSheets()
For Each WkSht In Worksheets
WkSht.Protect password:="password"
Next WkSht
End Sub

Note that for simplicity I have omitted some of the optional settings
that can be used in th third "Protect" line. (In XL2000
(DrawingObjects:=True, Contents:=True, Scenarios:=True but in XL
2002/2003 around a dozen other optional settings)

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=383063




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
Protect but Allow Edit Ranges in Multiple Sheets EugeniaP Excel Discussion (Misc queries) 6 September 25th 08 05:32 PM
Are there ways to protect multiple sheets at once? Monty New Users to Excel 3 May 29th 08 11:57 PM
Macro to protect multiple sheets? Stilla Excel Worksheet Functions 12 March 5th 07 07:03 PM
How do I protect multiple sheets at one time? Kelly Excel Worksheet Functions 1 February 27th 06 04:30 PM
How do I protect formula cells on multiple sheets? Webdiva Excel Worksheet Functions 0 May 3rd 05 08:29 PM


All times are GMT +1. The time now is 10:00 PM.

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

About Us

"It's about Microsoft Excel"