ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Copy protection from one worksheet to another (https://www.excelbanter.com/excel-worksheet-functions/191085-copy-protection-one-worksheet-another.html)

Johnell

Copy protection from one worksheet to another
 
Hi,

I have multiple worksheets in one workbook that I need to add protection to.
All the worksheets require the same protection with the same password. The
protection consists of 2 sets of "allow users to edit range" and overall
worksheet protection.

I have 2 questions:

1. Is there a way to copy the protection from one worksheet to another, or
create the protection to all worksheets via a macro, so I don't have to
protect each worksheet separately?

2. Is there way to unprotect all the worksheets with same password at one
time via a macro or other mechanism?

Thanks,

Johnell



Spiky

Copy protection from one worksheet to another
 
On Jun 12, 7:52 pm, Johnell wrote:
Hi,

I have multiple worksheets in one workbook that I need to add protection to.
All the worksheets require the same protection with the same password. The
protection consists of 2 sets of "allow users to edit range" and overall
worksheet protection.

I have 2 questions:

1. Is there a way to copy the protection from one worksheet to another, or
create the protection to all worksheets via a macro, so I don't have to
protect each worksheet separately?

2. Is there way to unprotect all the worksheets with same password at one
time via a macro or other mechanism?

Thanks,

Johnell


1. I don't think so.
2. I set up macros to do both lock/unlock and assigned them to toolbar
buttons so they are easy to use. Here's one, change "Unprotect" to
"Protect" for the 2nd. I was trying to get this to work on multiple
selected sheets, but this one only seems to work on one at a time.
There should be a way...it works with other commands, just not
"Protect". Maybe someone else can help both of us.

Sub Unlock_Sheets()
Dim x As Worksheet
For Each x In ActiveWindow.SelectedSheets
x.Unprotect Password:="xxxx"
Next x
End Sub


All times are GMT +1. The time now is 06:48 PM.

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