Using Radio Buttons to change images in a cell

Zacariah171

New Member
Joined
Apr 2, 2019
Messages
28
I'm trying to help with making a youth football playbook that is easy to interact with. On Sheet1, I have a list of plays in cells C2:C35 and radio buttons in cells D2:D35, and then have the range K2:Q20 merged as one cell and have added a rectangle shape ("Rectangle 1") around that border. On Sheet2, I have a bunch of images of the plays that were just copied from a playbook and pasted into the sheet. What I'm trying to do is select a radio button and that will Fill "Rectangle 1" with the corresponding Picture. So, if I select Option Button 3 (in cell D4), it will Fill "Rectangle 1" with "Picture 3" from Sheet2. There may be other ways to accomplish this, but this is just what I had in mind. I've read a thread about adding images to a resources folder but that was from 13 years ago and I haven't been able to figure out how to find that folder. I would like the pictures that I'm trying to add and cycle through to be saved in the workbook instead of using a file path to a file on my computer because this file will be emailed to the other parents. Thank you in advance for your help. Please let me know if more information is needed.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This took me about 2 hours to sort out (but I'm a ****** for a challenge sometimes).
EDIT - Wow, on this site you can't use the word that means lollipop and someone who can't pass up a challenge??

The only way I could get it to work is to store each image on the sheet in a image control. So if you have 12 pictures, you need 13 controls; 12 of them can be tiny (Image2, Image3 ... Image13), one would be the size you want for display (Image1). I did this in a standard module so I needed a sheet reference; you may not unless you intend to store images on another sheet in which case you will. You would also need to refer to your main sheet when referencing the image control, and refer to the pictures sheet when referring to those image controls.
VBA Code:
Sub OptioButton1_Click()

Set sht = Sheets("003")
sht.OLEObjects("Image1").Object.Picture = sht.OLEObjects("Image2").Object.Picture

End Sub

Sub OptionButton2_Click()

Set sht = Sheets("003")
sht.OLEObjects("Image1").Object.Picture = sht.OLEObjects("Image3").Object.Picture

End Sub
 
Upvote 1
Solution
Glad I could help & thanks for the recognition.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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