Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Independent Radio Buttons.
Written by Allen Wyatt (last updated May 6, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
Larry is using Excel to put together a way to track his performance at bowling. As part of his system, he would like to use the Controls toolbox to add radio buttons (sometimes called option buttons) to his worksheet, one for each of the ten pins. He would like a way to click on the radio buttons representing the pins he left standing after the first roll of the ball.
The problem is that radio buttons are not designed to allow multiple selections. When there are multiple radio buttons in a group, only one of the radio buttons in that group can be selected at a time. (This would be acceptable if Larry never left more than one pin standing after each roll, but such an expectation may be unreasonable.)
There are two options that can be tried. The easiest is to use check boxes instead of radio buttons. By design, check boxes are independent of each other; you can click one or all of them—it doesn't matter. You can easily arrange the check boxes in a triangular pattern to simulate the position of the bowling pins. To insert a checkbox, follow these instructions:
The drawback to this approach is that the check boxes are square. If this aesthetic does not meet your expectations, then the second approach might better. This approach involves putting each radio button into its own group.
Remember that only one radio button per group can be selected at a time. When you add radio buttons to a worksheet, they default to the same group, the name of which matches the worksheet name. As you add each radio button you could right-click on it and display its properties. One of the properties is GroupName; change this to something like Pin1, Pin2, etc. As long as each radio button uses a different group name, they will be considered independent of each other.
Even so, there is an advantage to using check boxes instead of radio buttons—a huge advantage. Check boxes can be selected and then deselected; radio buttons cannot. Thus, you can click once on a check box to select it and a second time to deselect it. If you try this with radio buttons, it won't work—once a radio button is selected, it is selected for good. This isn't that big of a deal if you have multiple radio buttons in the same group—if you make a mistake in clicking one, just click on another to undo it. If you configure the properties so there is one radio button per group, then you can only select that single radio button in each group; you cannot undo it.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11974) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Independent Radio Buttons.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
List boxes can be a great tool for getting input from users of your worksheets. This tip describes what list boxes are ...
Discover MoreForm controls can be a great way to get information into a worksheet. They are designed to be linked to a cell so that ...
Discover MoreLots of people prefer to enter information directly into Excel, but there is another way that may be helpful: Using data ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-05-08 12:10:04
Tomek
My previous comment was suspected as scam and after the review it got collapsed into one run-on block of text.
I am re-posting just the macro here for better clarity:
---------
Private Sub OptionButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = True
ActiveSheet.OLEObjects("OptionButton1").Object.Value = False
End Sub
--------
2023-05-08 11:25:19
Tomek
It is true that Radio Buttons cannot be deselected the way Check Boxes can, there may be a way or two around this:1. Each radio button can have a linked cell that keeps the status of that button. If you set that cell value to FALSE, the button will get unchecked. The linked cell assignment needs to be done for each button separately. This can be done from Developer Tab - Design Mode in the Properties window for the selected button. I assume these buttons are Active-X Controls (the Form Controls Option Buttons cannot be assigned to different groups as far as I know).2. You can create a macro assigned to DblClick event for each button that will uncheck the button. For example if the button name is "OptionButton1" the following macro will uncheck it: ---------Private Sub OptionButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Cancel = True ActiveSheet.OLEObjects("OptionButton1").Object.Value = FalseEnd Sub--------You need such macro for every button though, so it may get very involved.
2023-05-08 11:15:27
Tomek
In my Excel 365 Family, Radio Buttons from Form Controls cannot be assigned to a group. On the other hand, Active-X Radio Buttons can.
2023-05-06 12:27:02
Dave Bonin
It seems to me that Larry could draw a set of ten circle shapes and write a macro that would toggle each circle to add / clear an interior color.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments