Pls help!!! Event handler for array of cmmd buttons on Excel

mangoel

New Member
Joined
Apr 14, 2002
Messages
14
Hello All,

I am pretty new to VBA and am stuck on a problem that might be quite easy for some of you.

I have an Excel worksheet with 100 command buttons (from Forms toolbar), one per cell, as shown below. Associated with each of these buttons are numerical values in the same row of the next colum.

Row # Column A Column B
----- ---------------------------
1 CmdButton1 NumValue1
2 CmdButton2 NumValue2
: : :
100 CmdButton100 NumValue100

Assuming that I name these command buttons at design time, what I would like to do upon detection of a button click (any of the 100 buttons) is to call a function passing as parameters = the row number (associated with the button pressed), the name of the commandbutton pressed, and the corresponding "Numvalue" from that row.

What would be the best way to code something like this? This code would need to work in Excel versions 97 and up.
I know that something like a control array might be needed, but I really have no clue as to how to get started.

I'd really appreciate any help on this.

Thanks!

Manish
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,606
Messages
6,120,492
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top