Making a Cell Manual Entry or Return Calculated Value Based Upon Ratio Button Selection

Brandon81

New Member
Joined
Jan 24, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I currently have a cell that the user inputs an numeric value into (highlighted in yellow). What I am trying to achieve is if the radio button selected is "YES" then user still can manually enter a value into the cell but if the radio button is "NO" then the same highlighted cell now returns a calculated value and can't be manually keyed/overwritten while selection is "NO". I am wondering if that is possible with conditional formatting or some other way. Is this possible and if so, how do I set this up?

1645188534460.png
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You'll need to use VBA for this. To start, the code that I'm putting here is for ActiveX radio buttons, not form radio buttons. One button is named 'yes' and the other 'no'. The grouping property should be set so that when one button is clicked, the other is turned off automatically. And lastly, this involves protecting the sheet...so any cells that you need to remain editable, must have be unlocked.
So, in the developer screen, go to the sheet where your buttons exist and paste this code. You can set the password to one of your choosing, and also set the formula to whatever you need it to be.

Private Sub Yes_Click()
ActiveSheet.Unprotect Password:="password here"
Range("B2").Locked = False
ActiveSheet.Protect Password:="password here"
End Sub

Private Sub No_Click()
ActiveSheet.Unprotect Password:="password here"
Range("B2").Value = "=C2+D2"
Range("B2").Locked = True
ActiveSheet.Protect Password:="password here"

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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