I have a macro I've written that has a checkbox on a userform. I'd like that checkbox to either start out as checked or not checked, depending on certain logic. I also have code that runs when I use the mouse to click the checkbox and switch it between checked and unchecked. The problem is, when I try to just change the value of the checkbox, it always runs the code within the checkbox, which I don't want unless it is clicked with a mouse.
Here is a simplified version of my code (to get my point across)
Sub test()
If Range("K4") = "N/A" Then
UserForm1.CheckBox1 = True 'Only want value changed, not the macro run as if the checkbox was clicked
Else
UserForm1.CheckBox1 = False
End If
End Sub
'Code within UserForm
Private Sub CheckBox1_Click()
If CheckBox1 Then
TestValue = 42
End IF
End Sub
And help would be much appreciated, it's really frustrating.
Bookmarks