Try,
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Sheet1").Protect
Else
Sheets("Sheet1").Unprotect
End If
End Sub
Note, you can't have the checkbox in Sheet1 because it creates a conflict.
Hope this helps you out.
Barrie
Barrie Davidson
This code should work with the check box on active sheet :-
Private Sub CheckBox1_Click()
If Application.ExecuteExcel4Macro("get.document(7)") = True Then
ActiveSheet.Unprotect
Else
ActiveSheet.Protect
End If
End Sub
In addition, to cover the possibility of the protection status being changed via the menu command rather than by the check box :-
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.ExecuteExcel4Macro("get.document(7)") = True Then
ActiveSheet.Unprotect
CheckBox1.Value = True
ActiveSheet.Protect
Else
CheckBox1.Value = False
End If
End Sub