Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using Excel 2003 in Win XP
I've created several Combo Box controls (with the form toolbar) that trigger macros to execute code that depends on the row where the control is. The code only differs by the row number and I was looking for a way of getting this information from Excel inside the triggered macro. The only way I found so far is to create a separate macro for each Combo Box named after the row on which it sits. This macro then calls the common code passing it the row number. I searched the Excel Application model to no avail. Anybody know how to do this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wouldn't waste my time saving one line of code. You need a click macro for
each combobox. combobox1_click() Myrow = 1 call commoncode(Myrow) end sub combobox2_click() Myrow = 4 call commoncode(Myrow) end sub combobox3_click() Myrow = 7 call commoncode(Myrow) end sub "Mathieu''s Granpa" wrote: I'm using Excel 2003 in Win XP I've created several Combo Box controls (with the form toolbar) that trigger macros to execute code that depends on the row where the control is. The code only differs by the row number and I was looking for a way of getting this information from Excel inside the triggered macro. The only way I found so far is to create a separate macro for each Combo Box named after the row on which it sits. This macro then calls the common code passing it the row number. I searched the Excel Application model to no avail. Anybody know how to do this? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I kind of agree.
There are 3 Combo Boxes per row, the 2 leftmost restricting the scope of the one to their right. It's just that the worksheet contains some 90 such 1 line macros and it's not very pretty. Mind you, the users do not see that. Anyway, thanks for your answer "Joel" wrote: I wouldn't waste my time saving one line of code. You need a click macro for each combobox. combobox1_click() Myrow = 1 call commoncode(Myrow) end sub combobox2_click() Myrow = 4 call commoncode(Myrow) end sub combobox3_click() Myrow = 7 call commoncode(Myrow) end sub "Mathieu''s Granpa" wrote: I'm using Excel 2003 in Win XP I've created several Combo Box controls (with the form toolbar) that trigger macros to execute code that depends on the row where the control is. The code only differs by the row number and I was looking for a way of getting this information from Excel inside the triggered macro. The only way I found so far is to create a separate macro for each Combo Box named after the row on which it sits. This macro then calls the common code passing it the row number. I searched the Excel Application model to no avail. Anybody know how to do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error using a combo box with an assigned macro in Excel | Excel Worksheet Functions | |||
Error using a combo box with an assigned macro in Excel | Excel Discussion (Misc queries) | |||
Assigned macros change location | Excel Discussion (Misc queries) | |||
Disappearance of assigned value of varaible when working with form | Excel Programming | |||
Combo Box Inside a Form | Excel Programming |