Form Control Option Buttons - Linking to Cells VBA

Yourself93

New Member
Joined
Jun 1, 2016
Messages
41
Hi everyone, looking to see if anyone could help a beginner out with some vba code. I had posted a question previously and have (fortunately) figured out what the issue with that was, however I am now trying to move on to the next part (so let's get to it).

What I have been tasked with at work is to take a template and move a certain piece of it over to a form as it is needed. This template involves form control options buttons. Originally these were linked to cells in the template, however I removed that as I think it will be easier to do what we want with them if we just link them after they are moved. I currently have code that moves these unlinked option buttons to the designated area that is needed. However, what I then need to do is link every option button that is moved to a cell 25 columns to the right of where the option buttons are. I was thinking this could be done with the relative reference excel thing, but am not sure. All cells that have option buttons have 3 different options in them.

So, for example. With my current code I start on Cell A5. Currently in cell A4 it has "C" in it and in cell B4 lets say it has "3". If I run the macro I currently have it inserts a new row by moving everything down a row and copies what is above it for columns A and B (so Cell A5 now have C and Cell B5 now has 3). It also takes the format for the rest of the row and then copies what part of the template I have selected over to this row as well. This means cell J5 will now have 3 grouped option buttons in it. I would then want cell AI to link to these 3 option buttons. (note: You could also have another cell with option buttons in it like J and L so I would need J linked to AI and L linked to AK.) Final note, by selected for the template part I mean the vba code simply has that row chosen. If I wanted something else selected I would need to change the code, so I was just going to make a bunch of macros (one for each row) to deal with this as I do not know how to make that all into one either.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Sub Test2()
'
' Test2 Macro
'

'
ActiveSheet.Shapes.Range(Array("Option Button 205")).Select
With Selection
.Value = xlOff
.LinkedCell = "AG10"
.Display3DShading = False
End With
End Sub

I currently have the above from using relative reference in an attempt to do this, however as you can see it sets a specific option button to select and a specific linked cell. I would be looking to make this option button whatever option button is selected (is that possible?) and make the linked cell whatever cell is 25 columns to the right of the selected cell that the selected option button is in. This would also be a simpler version as some rows copied over could have multiple cells that need option buttons linked as I mentioned above.

p.s. I am the beginner of beginners so just explaining what I should do won't really help, I suck at coding (hate it really) so need help with what the actual code would be. I'm just a tad needy (I know).
 
Upvote 0
Can somebody at least let me know if the above is possible? If it isn't then at least I could stop wasting time on this.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,007
Members
448,935
Latest member
ijat

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