lundi 14 mars 2022

Either of the checkbox can only be true

Situation I have two form control check boxes. I am trying to write a code that will allow only either of them to be true.

Two form control check box

my code is

Sub CheckBox2_Click()
  If CheckBox1.Enabled = True Then
    CheckBox2.Enabled = False
  Else
     If CheckBox2.Enabled = True Then
         CheckBox1.Enabled = False
     End If
  End If    
End Sub

I have this code in module and have assigned the same macro for both the checkboxes. I get run-time error 424. I beleive this is very basic problem but I unable to dela with it. Thank you




Aucun commentaire:

Enregistrer un commentaire