mercredi 9 août 2017

How to execute macros associated with a check box in a UserForm

I am currently working on an analysis template for my work and have been having trouble writing my UserForm code. I have written all the macros associated with these checkboxes, but cannot get them to activate by clicking the seperate analysis command box. The macros are called: graph_dur, graph_ram, dur_calc, ram_calc.

As of right now I have a UserForm that allows users to check off which analyses they want, then after hitting the "Analysis" command button the calculations are run.see UserForm layout in link Any boxes that are not checked should not run their macros when "Analyze" is clicked.

I understand that when a checkbox is "checked" then it returns "True". What I don't understand is how to associate the True return with the run of a macro when "Analyze" is activated. This code is not correct, but attempts to highlight my basic layout.

Private Sub CheckBox1_Click() 

        If CheckBox1 = True
            Then Call.Graph_duration
            Else CheckBox1 = False
        End If 
End Sub

Private Sub CheckBox2_Click()

        If CheckBox2 = True
            Then Call.Graph_ram
            Else CheckBox2 = False
        End If
End Sub 

Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire