VBA Insert Row using ActiveX Radio Buttons

tinydoomfists

New Member
Joined
Jul 21, 2020
Messages
5
Office Version
  1. 2013
Platform
  1. Windows
Hello, I'm new to VBA.
I'd want to insert a row under in two columns only using "yes"/"no" option buttons (as shown).
When "yes" is selected a new row will be created.
If "no" is selected then the created row will be deleted.

Hoping for something simple enough that can be modified & used throughout the worksheet.

Thanks!
 

Attachments

  • excel caption.PNG
    excel caption.PNG
    4.3 KB · Views: 11

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.
You can't insert a row under 2 columns a row is an entire row.
Do you mean insert 2 cells? if yes how are you defining the cells to insert under i.e. selecting both cells, selecting 1 cell or something else?
 
Upvote 0
You can't insert a row under 2 columns a row is an entire row.
Do you mean insert 2 cells? if yes how are you defining the cells to insert under i.e. selecting both cells, selecting 1 cell or something else?

Cells! I meant, cells. & I'd be selecting both cells
 
Upvote 0
Testing it I am not sure about it as you lose the selection when you click the Option button.
 
Upvote 0
That's..... interesting.
Whatever you can send will be tremendously helpful. I can play around with it & see if I can find a way to make it work
 
Upvote 0
All that you need is
VBA Code:
If Range(yourcellrange) = True Then Selection.Offset(1).Insert
in one Option buttons code module and
VBA Code:
If Range(yourcellrange) = False Then Selection.Offset(1).Delete Shift:=xlUp
in the other
 
Upvote 0
All that you need is
VBA Code:
If Range(yourcellrange) = True Then Selection.Offset(1).Insert
in one Option buttons code module and
VBA Code:
If Range(yourcellrange) = False Then Selection.Offset(1).Delete Shift:=xlUp
in the other
Amazing! Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,435
Members
452,326
Latest member
johnshaji

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