I am trying to apply a macros to an active x button. When checking the button, it should enter password to unprotect worksheet, it wll only show rows of all true statements retrieved from Column AL, when unchecked it should allow the user to view all rows regardless if AL column is true or false, then apply the password again to lock the work sheet. This is my formula for the checkbox. Any help is greatly appreciated.
Code:
Private Sub CheckBox1_Click()
If CheckBox1 Then
ActiveSheet.Unprotect Password:="Insight"
ActiveCell.Locked = True
Range("AL5:AL154").AutoFilter Field:=1, Criteria1:="TRUE"
Else
ActiveSheet.AutoFilterMode = False
ActiveSheet.Protect Password:="Insight"
ActiveCell.Locked = False
End If
End Sub