![]() |
Using "protection" as a macro condition
Is there a way to refer to "protection" (its on/off condition), in a Macro
line? A simple example would be - If "protection is off" Then Worksheets("abc").Range("a5").Value = 0 I need to know the coding to use that would replace "protection is off" in the above line. It could also be connected to whether or not there is a password present. I hope this can be done. Ed |
Using "protection" as a macro condition
Look at help on
Protectcontents ProtectDrawingObject ProtectScenarios If Worksheets("Sheet1").ProtectContents = True Then MsgBox "The contents of Sheet1 are protected." End If In excel 2002 and later, also look at the protection object. I am not away of any property that will tell you if a password is required. No sure how useful it would be as you can try to unprotect the sheet without one, then see if you were successful or check the error (using On Error Resume Next to ignore an error response). -- Regards, Tom Ogilvy "Ed" wrote in message ... Is there a way to refer to "protection" (its on/off condition), in a Macro line? A simple example would be - If "protection is off" Then Worksheets("abc").Range("a5").Value = 0 I need to know the coding to use that would replace "protection is off" in the above line. It could also be connected to whether or not there is a password present. I hope this can be done. Ed |
All times are GMT +1. The time now is 06:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com