Code to assign a macro to hundreds of option buttons at once

C

Carl

I have hundreds of option buttons that need to have the same macro assigned
to each (too many to do manually). I am doing this so that when a button is
selected it will change a cell in the worksheet and run a worksheet change
macro. Thanks in advance!
 
P

Peter T

If you want to assign the same macro to all (Forms style) optionbutons on
the sheet, simply

ActiveSheet.OptionButtons.OnAction = "myMacro"

Otherwise you will need to loop option buttons looking for something
particular about one of the properties to dictate the OnAction string.

In passing, if you mean call worksheet change event code I doubt that's the
best approach.

Regards,
Peter T
 

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