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
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

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!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,911
Messages
5,575,001
Members
412,633
Latest member
simon_elvin
Top