Radio Button

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
I want to put radio buttons into a form. What code do I need for the button code to only run when OK is selected? thanks.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Let's say you have 3 buttons which are frequencies, For you to use the OK button you would need to reference the buttons that are selected i.e. option button to say this frequency, then you would press OK which would reference which button is selected then call a macro based on that button

Example Code for the OK button
VBA Code:
    If OptionButton1.Value = True Then
        Call Macro_Radio1Frequency
    ElseIf OptionButton2.Value = True Then
        Call Macro_Radio2Frequency
    ElseIf OptionButton3.Value = True Then
        Call Macro_Radio3Frequency
    End If
 
Upvote 0

Forum statistics

Threads
1,214,797
Messages
6,121,629
Members
449,041
Latest member
Postman24

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
Back
Top