vendredi 9 février 2018

excel macro - checkbox to select other checkboxes

i'm trying to have a selection of optoins via checkboxes. I want to have one specific box automatically check a few other boxes. i'm getting "Object required (Error 424)" when i click the box in question after assigning the macro below:

any help would be much appreciated

Public Sub CheckBox1_Click()
If CheckBox21.Value = True Then
    CheckBox2.Value = True
    CheckBox5.Value = True
    CheckBox6.Value = True
    CheckBox18.Value = True
    CheckBox19.Value = True
    CheckBox20.Value = True
    CheckBox22.Value = True
    CheckBox23.Value = True
    CheckBox2.Enabled = False
    CheckBox5.Enabled = False
    CheckBox6.Enabled = False
    CheckBox18.Enabled = False
    CheckBox19.Enabled = False
    CheckBox20.Enabled = False
    CheckBox22.Enabled = False
    CheckBox23.Enabled = False
Else
    CheckBox2.Enabled = True
    CheckBox5.Enabled = True
    CheckBox6.Enabled = True
    CheckBox18.Enabled = True
    CheckBox19.Enabled = True
    CheckBox20.Enabled = True
    CheckBox22.Enabled = True
    CheckBox23.Enabled = True
End If

End Sub




Aucun commentaire:

Enregistrer un commentaire