Re: Show Image Based On Cell Value
Quote from ExcelinternOkay, fyi my original code worked, I just had a naming error.
Your code has unnecessary info. It looks like there are two macros there (one for a message box and another to get your picture). Is that what you meant?
I haven't tried it, but it should've been written like this:
Code
Sub GetPicture()
Dim oPic As Picture, imgFlag As Range, imgMap As Range
' Loop Flag and Map images
'imgFlag = Worksheets("Image").Range("B1")
'imgMap = Worksheets("Image").Range("D1")
For Each oPic In Worksheets("Summary").Pictures
If (oPic.Name = Worksheets("Image").Range("B1").Text) Then
oPic.Visible = True
oPic.Top = Worksheets("Image").Range("B1").Top
oPic.Left = Worksheets("Image").Range("B1").Left
ElseIf (oPic.Name = Worksheets("Image").Range("D1").Text) Then
oPic.Visible = True
oPic.Top = Worksheets("Image").Range("D1").Top
oPic.Left = Worksheets("Image").Range("D1").Left
Else
oPic.Visible = False
End If
Next oPic
End Sub
Display More
I don't know if this would be useful, but I've explained how to create a conditional graphics in a workbook without using VBA.