View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
 
Posts: 3,346
Default protect unprotect toggle VBA

Here is a minimal sample

Private Sub CheckBox1_Click()
With CheckBox1
If .Caption = "Protect" Then
ActiveSheet.Protect
.Caption = "Unprotect"
Else
.Caption = "Protect"
ActiveSheet.Unprotect
End If
End With
End Sub

which I attached to a Control Toolbox checkbox

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Wanna Learn" wrote:

Hello I want to create a checkbox that when the box is checked rows 1 thru
70 are protected and when the box is unchecked worksheet is unprotected. I
created a macro to protect the sheet, then I created a macro to unprotect the
sheet . I combined both macros but it does not toggle. Thanks in advance