G
Guest
I have a macro in a worksheet that works in conjunction with a VLOOKUP to
display pictures based on the VLOOKUP. The appropriate picture displays at
the P16 cell location. My problem is when I put the macro in, it makes ALL
my graphic objects (PICTURE) disappear except for the one the VLOOKUP calls
for. How can I exclude some of the other graphic objects that are on the
sheet? I tried renaming the objects and it still didn't work i.e.(Picture
100 to Pic 100 and also tried Obj 100). It know someway that it's a graphic.
Here's the code I used:
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("P16")
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
display pictures based on the VLOOKUP. The appropriate picture displays at
the P16 cell location. My problem is when I put the macro in, it makes ALL
my graphic objects (PICTURE) disappear except for the one the VLOOKUP calls
for. How can I exclude some of the other graphic objects that are on the
sheet? I tried renaming the objects and it still didn't work i.e.(Picture
100 to Pic 100 and also tried Obj 100). It know someway that it's a graphic.
Here's the code I used:
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("P16")
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