Copy/paste via ActiveX optionbuttons in a frame

WildEep

New Member
Joined
Jun 22, 2012
Messages
2
My main Excel sheet contains a frame 'Optionbuttonframe', which contains 8 ActiveX optionbuttons (I'm doing that because I need the formatting features), alongside an empty block of cells I've merged and named 'Statementlocation'. I've given all the buttons the groupname 'country' in case it helps. On another sheet ('Statements'), there are cells A1:A8 listing 8 corresponding blocks of text, one of which is to be copied (value only, not format) into 'Statementlocation' depending on the selection of OptionButton1 to OptionButton8 on the frame on the main sheet.

What code do I need to make this happen, I can't seem to get Sub OptionButtonx_Click() procedures to do anything?

I'm pretty inexperienced with this stuff. I think it's to do with referencing things correctly, because if I put easy 'Hello World' commands in the procedures and step through them in the VBA editor, they work.

Also, I'm a bit worried about the paste method, because when I manually try to step throught what I want, the fact that I'm pasting one cell into a merged area triggers an error message (which my macro would also presumably encounter).

Hope someone can help!

WE
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hello and welcome to the Board

What Excel version are you using?
See if the following code is what you need. If not, just post back.

Option Explicit


Private Sub OptionButton1_Click()

ActiveSheet.Range("StatementLocation").Value = _
Worksheets("Statements").Range("a1").Value


End Sub


Private Sub OptionButton2_Click()

ActiveSheet.Range("StatementLocation").Value = _
Worksheets("Statements").Range("a2").Value


End Sub
 
Upvote 0

Forum statistics

Threads
1,206,761
Messages
6,074,780
Members
446,087
Latest member
PinkFloyd

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