Pictures in Excel

MOB

Well-known Member
Joined
Oct 18, 2005
Messages
1,055
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?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,925
Members
449,056
Latest member
denissimo

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