PDA

View Full Version : [SOLVED:] Selecting one OptionButton reset the choices in another Group



hrzagi
10-19-2021, 01:35 AM
Can someone help me with VBA code for OptionButtons. I have two groups with two choices in each, so in Group 1 i have "OptionButton 1" and "OptionButton 2" and in Group 2 I have "OptionButton 3" and "OptionButton 4". What I need is to reset choices in "Group 2" when "OptionButton 2" is selected. I found VBA code for reseting choices in "Group 2" but I don know how to run that code when "OptionButton 2" is selected. Thanx!


List1.Shapes("OptionButton 3").ControlFormat.Value = xlOff
List1.Shapes("OptionButton 4").ControlFormat.Value = xlOff

hrzagi
10-19-2021, 04:58 AM
Ok, I solved it and it was actually easy. Here is my code if anyone need it.

Sub OptionButtonReset ()
Set OptBtns = Me.OptionButtons
List1.Shapes("OptionButton 3").ControlFormat.Value = xlOff
List1.Shapes("OptionButton 4").ControlFormat.Value = xlOff
End Sub