Using an Option Button to control other Option Buttons

Airfix9

Well-known Member
Joined
Sep 23, 2005
Messages
886
Hi all,

Beginner programmer here - I tend to record macros and then go into the code to see what they have created, so VERY basic stuff. In short, please be kind to me!

I have a spreadsheet containing pairs of Option Buttons so that the user can make preference selections on how data is displayed on another sheet within the file - there are around a dozen Yes/No options shown.

What I would like to do is to put in another pair of Option Buttons which will select "Yes" to all or "No" to all. I can do this by using the Call function, but it doesn't actually select the Option Buttons properly - ie, if I say "No" to all, then the data changes on the correct sheet, but all the Option Buttons on the select sheet are set to "Yes" still.

How do I get the code to change whether each button is checked or unchecked?

Any help gratefully received!

Many thanks

AF9
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

farnuckl

Board Regular
Joined
Dec 16, 2003
Messages
127
Hello, you just need to use something like this:

Code:
optionbutton1.value=true
optionbutton2.value=true

So when you run the code, it will change the option buttons to true or false, whatever the situation.

-Farnuckl
 

Airfix9

Well-known Member
Joined
Sep 23, 2005
Messages
886
Thanks for that - actually managed to solve it myself. I didn't realise that you could link two buttons to a single cell and that that cell would determine whether the button was checked or unchecked. Now, on the "Yes to all" button, I have a macro that changes all the linked cells to the Yes value as well as calling the relevant macros.

VB - it'll either kill me or cure me!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,504
Messages
5,832,106
Members
430,111
Latest member
Francis Xavier

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
Top