VBA delete value from cell

f_b2050

New Member
Joined
Oct 30, 2017
Messages
5
Hi,

i'm trying to make a template. One of the questions uses radio buttons. if radio button 1(yes) is selected, no further info is needed. if radio button 2(no) is selected, extra info needs to be inserted in cell F15. (the linked cell for the radio buttons is O15)

I want to delete this info if the user decides to select radio button 1 again.

Can someone provide me with the VBA code please?

THanks!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
If its an ActiveX Option button try
Code:
Private Sub OptionButton1_Click()
If OptionButton1 Then Range("F15").ClearContents
End Sub
 
Upvote 0
Ok, is there also a code for a form control? or should i change them to an active x control?


Just for another (little) issue: i have a cell which contains a data validation (list). If one of the options is chosen, extra information is necessary cell(G30). If this info was completed and i change it to another value which doesn't require the extra info, i want the cell G30 to be empty again. For the moment I have the following code but it doesnt work:

if cells(28,"C").value<> "No" then
cells(30,"G").value=""
end if

What did i do wrong?
 
Upvote 0
For a form Control try this in a standard module
Code:
Sub Macro1()
If ActiveSheet.OptionButtons(Application.Caller) Then Range("F15").ClearContents
End Sub
For your 2nd issue, could you supply the entire code?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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