Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? | Excel Programming | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) | |||
Stop users from accessing "Protection" option from "Tools" menu | Excel Programming | |||
Sending macro based e-mail with built-in "Heading" and "Text" | Excel Programming |