Event Macro With Multiple Pictures

X

Xen

Hi,

To paint a picture for you all. Sheet 1 is a basic spreadsheet, the
important part being i have a heading and a picture that goes with it. For eg
Heading might be "Panther" and i have a jpg of a panther that sits above the
heading. Sheet 2 is a small table with heading in one coloumn and a jpg
reference in the other,

I usually Retype a heading then drag the correct jpg to the new location. I
found this macro which works fine for cell reference but i cant get it to
work for other cells on the same sheet.
Have got the following macro working fine using a Vlookup formula in cell
"A3":

Option Explicit

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A3")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub
So i all do is type in Panther and the jpg auto appears, fantastic!

Problem is i want this function to work at cell D3 also. note ("A3:D3") does
not work).

Any help or suggestions would be greatly appreciated.
 
G

Gord Dibben

Looks like John McGimpsey's lookuppics code.

Only allows for one image at a time to be displayed.

Got to Debra Dalgeish's site for a sample workbook from Bernie Dietrick for
adding pictures to selections.

Alows for more than one picture to be displayed based upon a value or item
chosen from DV lists

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection

Edit the code to suit.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top