How to get the location of a Form Combo Box inside the assigned ma

M

Mathieu''s Granpa

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?
 
J

Joel

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
 
M

Mathieu''''''''s Granpa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top