Create a VBA button to open an image in worksheet

gary2014

Board Regular
Joined
Mar 31, 2012
Messages
67
Hi!

(Sub-Create a button to open an image in worksheet)

I've been asked to have an image (small jpg file) appear and disappear in an Excel worksheet that is being used as a form. In other words, they want the user to click on a Command Button which will display an image, then give him/her the option to click the button again and the image disappears (They didn't specifically ask for a button, but I guess a button is the best option based on what I read on other threads in this forum, however if there is an alternative, that would work for me too!).

I have no experience with VBA, and I wasn't able to find a similar example to my situation in this forum, where I could copy and paste the code in VB.
ABCD
1
Command Button 1 (Click here Mobile Phone pic)
The Mobile Phone pic should display here
2Command Button 2 (Click here Head Phone pic)The Head Phone pic should display here
3Command Button 3 (Click here Land Phone pic)The Land Phone pic should display here
4

<tbody>
</tbody>
The Mobile phone pic is already in this same worksheet (Cell B90)
The Head phone pic is already in this same worksheet (Cell B113)
The Land phone pic is already in this same worksheet (Cell B135)

Please revert back if I am not clear
 
The actual file is in office & we are not allowed to send it externally.
However, I can make a replica of it for u.
Can u plz guide me on how to send u that file?
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi Geek,

Please find attached herewith the link.

Zippyshare.com - Gary.xlsm

This is the exactly the same model of workbook which I am trying to create in office.

Password for Excel Sheet is 1234

I am unable to create the VBA Code for three Images "Korfball, Sepaktakraw and Kabbadi".

Pls help me this.
 
Upvote 0
Hello Geek,

Thank you very much for you help, you have a superb knowledge in VBA. "Hats off" sir :)

I have one last requirement for this sheet.

I want to create three "Message Box" pop ups in Cells B8, B14 and B18. (Condition is "Message Box" should appear only when there is a value in cells B7, B13 and B17.

I am sharing the copy of a sheet for your reference.

Zippyshare.com - Gary21812114.xlsm
 
Upvote 0
try adding this code

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address(False, False)
    Case "B7"
        Me.Shapes("Oval Callout 5").Visible = (Target.Value <> vbNullString)
    Case "B13"
        Me.Shapes("Oval Callout 18").Visible = (Target.Value <> vbNullString)
    Case "B17"
        Me.Shapes("Oval Callout 16").Visible = (Target.Value <> vbNullString)
End Select
End Sub
 
Upvote 0
Hi VBA Geek,

When I'm using the option button code in my office I'm facing the following problem:
1. The option button size increases every time I click on it.
Or
2. The size of text which I've written in the option button decreases every time I click on option button.

I transferred the Gary21812114 file to my office computer for refere & I'm facing the same problem with that file as well.
Whereas Gary21812114 file works perfect in my home computer.

Please advise.
 
Upvote 0
Hi VBA Geek,

I'm in final stage of my project. I thank you for your expert guidance and help in this regard.

I need your help in this critical hour.

I hope you remember that you set up 3 "Option Buttons" viz, "Korfball", "Sepaktakraw" and "Kabbadi".

I want to set up condition to one of the Option Button "Kabbadi".

The Option Button "Kabbadi" should activate only when there is a value in cell A27 or B28. (file enclosed for reference)
or
The ability to click on the Option Button "Kabbadi" should be enabled only when there is a value in cell A27 or B28. (file enclosed for reference)

Zippyshare.com - Gary.xls

I request you to help me with this so that I can complete my project.
 
Upvote 0
Hi Darren,

I'm in final stage of my project. I need your help in this critical hour.

I set up 3 "Option Buttons" viz, "Korfball", "Sepaktakraw" and "Kabbadi".

I want to set up a condition to one of the Option Button "Kabbadi".

The Option Button "Kabbadi" should activate only when there is a value in cell A27 or B28. (file enclosed for reference)
or
The ability to click on the Option Button "Kabbadi" should be enabled only when there is a value in cell A27 or B28. (file enclosed for reference)

Zippyshare.com - Gary.xls

I request you to help me with this so that I can complete my projec
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,280
Members
449,149
Latest member
mwdbActuary

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