Try something like this:
I am assuming you are using the ActiveX CheckBox. If you are using the Forms CheckBox the check the value of the Linked Cell.Option Explicit Sub Macro1() ActiveSheet.Protect Password:="MyPass", UserInterFaceOnly:=True If ActiveSheet.CheckBox1.Value = True Then Range("A1:B5").Locked = False Else Range("A1:B5").Locked = True End If End Sub
Also the If statement can be reduced to this:
Range("A1:B5").Locked = Not ActiveSheet.CheckBox1.Value