Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have written a macro, which contains many userform. each userform
contains many comboboxes (in addition to may other controls) I want several things to happen when the value in the combobox is changed. Here is an example of the code that i currently have in the combobox change event procedu Private Sub ComboBox10_Change() Dim ftype As Integer Recalc ftype = 2 + ComboBox10.ListIndex Call PriceToCell(12, ComboBox10, 20, ftype) End Sub Private Sub ComboBox11_Change() Dim ftype As Integer Recalc ftype = 2 + ComboBox11.ListIndex Call PriceToCell(12, ComboBox11, 18, ftype) End Sub etc.... I repeat this code many times where everything is almost exactly the same, except for the text "ComboBox10" would be the name of the combobox, and the the text "20" is specific for each combobox. what i would like to do is make this code generic so that i can copy it everywhere i need it without having to change it everytime, or even better refer to a procedure in my main module call..... so my first idea is initializing the combobox so that the value of combobox.tag in this case would be 20. Then i could replace the text 20, which is specific with something like Cint(ComboBox10.tag). But i still need to find some way to replace the specific ComboBox name, not in the name of the procedure, but only within the procedure. I have some idea that there is a solution to this involving setting up a class module, but i am not sure that i understand all the complexity of that. I thought the generic "Me" might work, but that gives me an error. any advice you have would be a big help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Event Procedures in an Add-In | Excel Programming | |||
learning event procedures | Excel Programming | |||
Event procedures (and the temple of doom) | Excel Programming | |||
Event Procedures: Event on Worksheet to fire Event on another Worksheet | Excel Programming | |||
Creating Event procedures from a macro | Excel Programming |