i would like to have an array of objects in excel that call one event handler. specifically I have multiple buttons which perform the same function to different cells, and to keep from duplicating code I would like to simply reference these button objects via an index (like I used to do in VB 6.0)…. by finding which button was clicked I would like to populate specific cells etc. so the question is: an array of buttons in excel VBA? I’ve done a little work in VB.net where I used collections, and that worked well… but it appears I can’t do that in VBA.
Share
Separate the common code into a single method and pass the cell as the parameter. Assign each button it’s own event method, which in turn calls the common method with the specific cell to edit as a parameter. Something like this:
So each button could be assigned to it’s own method. This is already built in so don’t try to recreate it, keep it simple.