View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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.