Hiding an Option Button based on cell value

fordgale

New Member
Joined
Jul 11, 2011
Messages
10
Hi,
this is my first post, and I am new to excel programming so struggling to make sense of it. I want to show/hide various rows depending on the output of an option box. Thanks to responses to other posts in MrExcel I have successfully managed to do this, except for an Option Button that is contained within the 'hidden' rows which still remains. I assume this is because it is 'floating' rather than attached to a unique cell, but I could be wrong. My current code is this:

Private Sub FuelSource1_Click()
If FuelSource1.Value = True Then Range("Fuel_Source").Value = 1
If FuelSource1.Value = True Then
[20:37].EntireRow.Hidden = True
Else: [37:47].EntireRow.Hidden = False
End If
End Sub

I tried inserting the following but it didn't work:
If FuelSource1.Value = True Then
"Forms.OptionButton.1".Hidden = True

I am so close to being able to make Excel do what I want it to do and this is my last (I hope) stumbling block. If I can't solve this I may be back to the drawing board with days of work wasted, so I am in desperate need of some advice. Can anyone please tell me if there is a way to hide the Option Button as well as the rows?

Thank you so much.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
If the option button is on "Sheet1" and named "OptionButton1", try:

Sheets("Sheet1").OptionButton1.Visible = False
 
Upvote 0
Thanks for your prompt reply - it is great to know there is expert help at hand when you are a nervous novice!

I also found that by clicking on Format control/Properties/Move and Size with cells I could also solve the problem.

Thank you.
 
Upvote 0
when the value in my reference cell changes to a different value, does yor optionbutton1 appear, as you expect?
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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