Introduction
In this post, I will share how to set Option Buttons (also known as Radio Buttons) on a UserForm to be unselected (OFF) by default.
Environment:
- OS: Windows 10 Pro
- Version: 20H2
Background
I placed two option buttons, “Yes” and “No,” on a UserForm. However, when I opened the form, one of the buttons was already selected (ON). I wanted both buttons to be unselected (OFF) when the form first appears, so I looked for a way to configure this.
Solution: Set the “Value” Property to “False”
To turn off the initial selection of an Option Button, you simply need to set its Value property to False.
Steps
- Open VBE (Visual Basic Editor) Press
Alt+F11to open the VBA editor. - Select the UserForm Open the target UserForm.
- Select the OptionButton Click on the Option Button you want to modify.
- Find “Value” in the Properties Window It is easier to find if you look at the “Alphabetic” tab in the Properties Window.
- Change the Value Change the
Valueproperty toFalse.
Note
Often, one button is set to True (selected) and the other to False (unselected) by default. If you want to ensure that both buttons are OFF when the form loads, you can also set this explicitly using the Initialize event in your code.
Private Sub UserForm_Initialize()
OptionButton1.Value = False
OptionButton2.Value = False
End Sub
This code forces all specified option buttons to be unselected when the form opens.
Summary
- The initial state of an Option Button is controlled by the
Valueproperty. - Be aware that the default setting may be
True, causing an unintended pre-selection. - Setting the property to
Falseensures the button starts as unselected. - For more flexible control, using the
UserForm_Initializeevent is also effective.
This small adjustment helps in designing user-friendly forms by ensuring no assumptions are made about the user’s choice.
