PDA

View Full Version : How to disable the sheets protection



jacque
04-17-2018, 03:22 PM
I have an excel file that has several sheets, I like todisable the protection from the sheets. I created a Vba that protects all the sheets automatically, upon closing. The problem is that some of the workersprotect an individual sheet, which interferes with the Vba, during closing.
In advance, any help is appreciated

Paul_Hossler
04-17-2018, 03:49 PM
.ProtectContents is True is the worksheet is already protected

So maybe something like this in your Close macro would skip trying to protect a sheet that is already protected





If Not Worksheets("ABC").ProtectContents Then
Worksheets("ABC").Protect .......

jacque
04-26-2018, 09:47 AM
Paul, thanks for the suggestion.
Originally, when I wrote this request I was in rush going toan airport so I did not explain the situation, so I apologize for theconfusion. This is the situation.
I created a macro that protects all the sheets upon closingthe workbook, with the given password in the protect_close macro. There are times when during data entry I haveto unprotect a sheet. During this timethe staff could protect a sheet manually and use a different password, which isin the protect _close macro.
I like to modify the Vba to ensure that if a person istrying to protect a sheet, the password would match the protect_close passwordmacro.
Thanx in advance.