Hello All,
I have an 11 tab multipage userform in my workbook. Each page has either several text boxes, combo boxes or a combination of both.
I want to use the combo boxes as an example.
Each combo box is tied to a control source so that when the user selects a value, the cell in the workbook gets that value. So far so good.
After the combo box is clicked, the exact same VBA code is run for each ... here is an example using the combo box called, "dues1_combox". There are a few dozen combo boxes all with unique names.
As the code to be executed after clicking is the same for each of the several combo boxes, rather that write a click event for each combo box, I would like to use the class module and then whenever any combo box that is a member of that class is clicked, run the same VBA.
I have been reading the forums on how one can do this, but frankly am getting confused.
As I understand it, the steps are:
Thanks for your help.
Steve
I have an 11 tab multipage userform in my workbook. Each page has either several text boxes, combo boxes or a combination of both.
I want to use the combo boxes as an example.
Each combo box is tied to a control source so that when the user selects a value, the cell in the workbook gets that value. So far so good.
After the combo box is clicked, the exact same VBA code is run for each ... here is an example using the combo box called, "dues1_combox". There are a few dozen combo boxes all with unique names.
VBA Code:
Private Sub dues1_combobox_Click()
Me.close_button.SetFocus 'Change focus to the userform Close Button
Call update_controlpanel ' Refresh the control panel
End Sub
As the code to be executed after clicking is the same for each of the several combo boxes, rather that write a click event for each combo box, I would like to use the class module and then whenever any combo box that is a member of that class is clicked, run the same VBA.
I have been reading the forums on how one can do this, but frankly am getting confused.
As I understand it, the steps are:
- Create class module
- Add objects (in this case the combo boxes) to the class
- Create Sub for the class with the code above
Thanks for your help.
Steve