Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return boolean if sheet is currently protected
I want to Create a simple Sub that protects the sheet if it is not currently
protected, and unprotects the sheet if it is protected... i.e. Sub SheetProtect () If ActiveSheet.Protect = true then ActiveSheet.Unprotect Else ActiveSheet.Protect End If End Sub The part that I need help with is obviously the "If" argument. Any help would be appreciative. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return boolean if sheet is currently protected
Hi Mike,
Try this With ActiveSheet If Not .ProtectContents Then .Protect Else .Unprotect End If End With -- HTH RP (remove nothere from the email address if mailing direct) "Mike" wrote in message ... I want to Create a simple Sub that protects the sheet if it is not currently protected, and unprotects the sheet if it is protected... i.e. Sub SheetProtect () If ActiveSheet.Protect = true then ActiveSheet.Unprotect Else ActiveSheet.Protect End If End Sub The part that I need help with is obviously the "If" argument. Any help would be appreciative. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return boolean if sheet is currently protected
Thanks much.
"Bob Phillips" wrote: Hi Mike, Try this With ActiveSheet If Not .ProtectContents Then .Protect Else .Unprotect End If End With -- HTH RP (remove nothere from the email address if mailing direct) "Mike" wrote in message ... I want to Create a simple Sub that protects the sheet if it is not currently protected, and unprotects the sheet if it is protected... i.e. Sub SheetProtect () If ActiveSheet.Protect = true then ActiveSheet.Unprotect Else ActiveSheet.Protect End If End Sub The part that I need help with is obviously the "If" argument. Any help would be appreciative. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
lookup single value in one sheet, return multiple results from theother sheet | Excel Worksheet Functions | |||
Protected sheet disables return key. | Excel Discussion (Misc queries) | |||
using array, Match, trying to eliminate duplicates - how to return or translate result to a boolean? | Excel Programming | |||
Return to Current Sheet in On (sheet activate) event macro | Excel Programming | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming |