ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the location of a Form Combo Box inside the assigned ma (https://www.excelbanter.com/excel-programming/404039-how-get-location-form-combo-box-inside-assigned-ma.html)

Mathieu''s Granpa

How to get the location of a Form Combo Box inside the assigned ma
 
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?



joel

How to get the location of a Form Combo Box inside the assigned ma
 
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?



Mathieu''''''''s Granpa

How to get the location of a Form Combo Box inside the assigne
 
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?




All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com