Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2007

Tip: Looking for answers? Try searching our database.

protect & unprotect sheets

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Khalil Handal - 24 Jun 2007 12:09 GMT
Is there a way to protect and unprotect *multiple* sheets at once. All the
sheets have the same password (say 1234).
Nick Hodge - 24 Jun 2007 13:33 GMT
Khalil

You could use code like below, but cannot do it through the UI

Sub ProtectAll()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:="1234"
Next wks
End Sub

Sub UnProtectAll()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Unprotect Password:="1234"
Next wks
End Sub

Signature

HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS
web: www.nickhodge.co.uk
blog (non-tech): www.nickhodge.co.uk/blog/

> Is there a way to protect and unprotect *multiple* sheets at once. All the
> sheets have the same password (say 1234).
Gary''s Student - 24 Jun 2007 13:42 GMT
If you have sheets within a workbook that are all password protected with
"secret", then this small macro will un-protect all at once:

Sub AtRisk()
MyPass = "secret"
For Each sh In Sheets
   sh.Unprotect (MyPass)
Next
End Sub

Signature

Gary''s Student - gsnu200733

> Is there a way to protect and unprotect *multiple* sheets at once. All the
> sheets have the same password (say 1234).
Khalil Handal - 24 Jun 2007 15:05 GMT
Thank you both. It worked fine

> If you have sheets within a workbook that are all password protected with
> "secret", then this small macro will un-protect all at once:
[quoted text clipped - 9 lines]
>> the
>> sheets have the same password (say 1234).
Gord Dibben - 24 Jun 2007 15:35 GMT
See response at the other thread you tagged onto.

Gord Dibben  MS Excel MVP

>Is there a way to protect and unprotect *multiple* sheets at once. All the
>sheets have the same password (say 1234).
Khalil Handal - 24 Jun 2007 20:59 GMT
Thanks for the note. Withot it I would have missed it.

> See response at the other thread you tagged onto.
>
> Gord Dibben  MS Excel MVP
>
>>Is there a way to protect and unprotect *multiple* sheets at once. All the
>>sheets have the same password (say 1234).

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.