Pictures in Excel

MOB

Well-known Member
Joined
Oct 18, 2005
Messages
1,031
Office Version
  1. 365
Platform
  1. Windows
Long shot I think.............but is it possible to have a macro that shows a certain picture based on a cell value?

So on another sheet I would have a list of 20 football teams, with their logo's in GIF format next to them.

Then on the main sheet, if I type in "team A" into a call, their logo appears next to the name?
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

MorganO

Active Member
Joined
Nov 21, 2006
Messages
483
This is not so hard. If you add your pictures to Sheet 2 and rename them with your Team Names you can use the following VBA code (pasted into Sheet1) to add the pictures to Sheet1 when you enter the team name into a cell:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Compare the names of all objects on Sheet2 against the Target and Paste
'a copy of the picture onto Sheet1
Dim sp As Shape
For Each sp In Worksheets("Sheet2").Shapes
 If Target.Value = sp.Name Then
   sp.Copy
   Worksheets("Sheet1").Paste
 End If
Next
End Sub

I will leave it you you to align the pictures properly when they are pasted onto Sheet1.

Take care.

Owen
 

Sneech#7

Active Member
Joined
Oct 22, 2004
Messages
284
Another possibility might be to have all the logos resident on the sheet in question and have your macro set all the shapes' visible property to false except the one that is entered - set that one to true.

e.g. ActiveSheet.Shapes("giants").Visible = False
 

Watch MrExcel Video

Forum statistics

Threads
1,122,387
Messages
5,595,879
Members
414,029
Latest member
mrwilker

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
Top