
Originally Posted by
YasserKhalil
Thanks a lot Mr. AlphaFrog for reply
So what is the benfit of Mr. Mike's code?
I don't know. You would have to ask Mike.
I suppose Mike's is not dependent on hard-coding the option button names to their macros. If you wanted to change the assigned macro for a particular option button, you wouldn't have to change the code.
I would suggest it's a little more concise to use an OptionButton object and the OptionButtons collection instead of looping through the Shapes collection. This does the same thing.
Sub Button1_Click()
Dim ob As OptionButton
For Each ob In ActiveSheet.OptionButtons
If ob.Value = xlOn Then Application.Run ob.OnAction
Next ob
End Sub
Bookmarks