View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Xen Xen is offline
external usenet poster
 
Posts: 1
Default Event Macro With Multiple Pictures

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.