Hide Rows if Option Button Value Changes?

osscie3

Board Regular
Joined
Apr 30, 2014
Messages
70
I've found examples that are very close to mine but still haven't solved what I'm trying to do.

Using ActiveX controls.

I have radio buttons linked to cells with If statements to adjust accordingly. For example:

A1 = "Yes"
Option Button 1 is linked to cell B2. B2 = IF(A1="Yes",TRUE,FALSE)
Option Button 2 is linked to cell B3. B3 = IF(A1="Yes",FALSE,TRUE)

So the option buttons are adjust accordingly. I originally just physically selected the option buttons. On selecting the option buttons, I had code that hid rows. But that was based on the onClick action. My code was:
VBA Code:
Private Sub OptionButton1_Click()

If OptionButton1 = True Then
    Worksheets("Sheet A").Rows("62").EntireRow.Hidden = True
    Worksheets("Sheet A").Rows("61").EntireRow.Hidden = False

End If

End Sub

Is there a way to tweak this code to fire if the value changed rather than me having to physically click on the radio buttons to fire the code? Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,786
Messages
6,121,553
Members
449,038
Latest member
Guest1337

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