ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet protection (https://www.excelbanter.com/excel-programming/363034-worksheet-protection.html)

ordnance1

Worksheet protection
 
I have a workbook with 12 sheets. What I would like to do is protect all 12
with a password of "Popcorn", without having to select each sheet. Then I
would like to do the reverse of unprotecting them without having to select
them.

colofnature[_41_]

Worksheet protection
 

You could add two routines to your workbook:

sub protect_all_sheets()
for each w in thisworkbook.worksheets
w.protect password:="Popcorn"
next
end sub

sub unprotect_all_sheets()
for each w in thisworkbook.worksheets
w.unprotect password:="Popcorn"
next
end sub



Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=547518



All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com