enable/disable radio buttons

jessetcobanez

New Member
Joined
Mar 11, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Can someone help me regarding enable/disable radio buttons?

Sample:
Asia
-PHP
-SGP
-VIE

Europe
-ROM
-DEN

There will be radio buttons on each items.
If I select Asia, I want to disable all radio buttons in Europe including the options below Europe (ROM and DEN) and vice verse.

Thank you!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I am not sure how your form looks but I built one based on your description, I hope this helps.

VBA Code:
Private Sub rdPHP_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdSGP_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdVIE_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdAsia_Click()
    rdROM.Value = False
    rdDEN.Value = False
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdROM_Click()
    rdEurope.Value = True
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub

Private Sub rdDEN_Click()
    rdEurope.Value = True
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub

Private Sub rdEurope_Click()
    rdPHP.Value = False
    rdSGP.Value = False
    rdVIE.Value = False
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub
 

Attachments

  • forRadioButtons.jpg
    forRadioButtons.jpg
    10.9 KB · Views: 12
Upvote 0
You could look into disabling frames also since the buttons are in Frame1 and Frame2.
 
Upvote 0
I
I am not sure how your form looks but I built one based on your description, I hope this helps.

VBA Code:
Private Sub rdPHP_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdSGP_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdVIE_Click()
    rdAsia.Value = True
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdAsia_Click()
    rdROM.Value = False
    rdDEN.Value = False
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub

Private Sub rdROM_Click()
    rdEurope.Value = True
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub

Private Sub rdDEN_Click()
    rdEurope.Value = True
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub

Private Sub rdEurope_Click()
    rdPHP.Value = False
    rdSGP.Value = False
    rdVIE.Value = False
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub
This is very helpful! Thank you so much! Is it possible to do this if I have the form ready already? I don't have the Data Entry form type but simple survey created in Excel cells.
 
Upvote 0
Yes, maybe post a screenshot of what you currently have in Excel.
 
Upvote 0
Something like this. Initial question is the Yes/No options then the selection in column F and H will be dependent on their initial answer.

1648173143275.png
 
Upvote 0
So using my code example, you would set up "Yes" and "No" similar to Europe and Asia. "Yes" and "No" would turn the opposite of it's subgroup to False.

VBA Code:
Private Sub rdEurope_Click()
    rdPHP.Value = False
    rdSGP.Value = False
    rdVIE.Value = False
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub

Private Sub rdAsia_Click()
    rdROM.Value = False
    rdDEN.Value = False
    'This clicks Asia and defaults Europe to unclicked.
    'Then the code in Asia runs so ROM and DEN becomes unclicked.
End Sub


The buttons in the subgroup would make a call back to either "Yes" or "No" when it's clicked. Which clears the ones not in the group with it's False statement that was set up above. Like with ROM below:

VBA Code:
Private Sub rdROM_Click()
    rdEurope.Value = True
    'This clicks Europe and defaults Asia to unclicked.
    'Then the code in Europe runs so PHP, SGP, and VIE becomes unclicked.
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

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