Excel ActiveX control checkbox not updating and not reacting after the first click on it

74 Views Asked by At

I am using a Windows 10, 64bit PC with Office 2019.

I was working on a VBA code with activeX controls and at a certain point I noted a change in which the activeX controls react when the user changes their value property by clicking on them.

Here the snippet code to test the "anomalous" control behavior.

Private Sub CheckBox1_Click()

    'Toggle state when clicked
    If Range("a1") = "State ONE" Then
        Range("a1") = "State TWO"
    Else
        Range("a1") = "State ONE"
    End If
    
    'Write if box is checked or not in cell A2
    If CheckBox1 = True Then
        Range("a2") = "box1 is checked"
    Else
        Range("a2") = "box1 is unchecked"
    End If
    
End Sub

And here is what I see on my screen:

enter image description here

Now it follows the test sequence:

  1. if try to put a tick in the CheckBox1 by clicking once on the box nothing changes in the worksheet
  2. however, if I click on the box a second time the box state in cell A1 toggles and "box1 is checked" appears in cell A2. Nevertheless I cannot see any tick in the box on the worksheet.
  3. behavior in point 2 remains each time I click twice on CheckBox1 (A2 carries on toggling from "box1 is checked" to "box1 is unchecked")
  4. the tick mark on the box updates only if after having clicked twice I go out from CheckBox1 e.g. by selecting an arbitrary cell on the worksheet

To summarize it, I concluded there are 2 anomalies (at least for me):

I] the tick mark on the box is not updating unless I click on an arbitrary cell

II] I have to click twice to change the value of the control (ticked or not ticked)

The same controls reacted however instantly and the control image updated also instantly after the first click before something changed. I suspect it maybe a changed accidentally some VBA setting or so, but after hours and hours of attempts and googling I an still stuck on this issue.

So the question: can anyone give an idea about what my checkbox is not reacting and updating instantly after a click on it?

0

There are 0 best solutions below