Grouping buttons

Copper Contributor
Hi, I have a form containing 25 command buttons divided into 5 groups. I want them to behave like a radio button, that is, when I click a button in group "a" it will be red and all other 4 button of the group remain blue (for example). Till now I used a function to set all buttons first:
Function groupA()
B1.quickstyle=1
B2.quickstyle=1
B3.quickstyle=1
B4.quickstyle=1
B5.quickstyle=1
End function

Then in every button click event I change its color:
Sub B1_click()
groupA
B1.quickstyle=8
End sub

Is there a better way?
3 Replies

@Yassirmosawi 

What you want is a set of Option Groups, five in all. Each of these Option Groups will contain 5 of your buttons.

optiongroup.jpg

Thanks, that's what I need. Can I make the quickstyle of the selected button (toggle button) change when it is selected (clicked)?
I'm not sure how much control you have over the appearance of radio buttons. Perhaps try it out and see if the default behavior is sufficient.