Hello,
I got the following code from this forum itself that works great:
It does not work with cell J1. I am not sure what do i have to do to make it work. I want both pictures to show up when two different values are selected in those two cells.
Thanks
Asad
I got the following code from this forum itself that works great:
But when I change it to the following code:Private Sub Worksheet_Change(ByVal Target As Range)
Dim oPic As Picture
Me.Pictures.Visible = False
If Target.Address <> "$A$1"Then Exit Sub
With Range("A1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
With Range("A10")
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
End With
Exit For
End If
Next oPic
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oPic As Picture
Me.Pictures.Visible = False
If Target.Range <> ("$A$1""$J$1") Then Exit Sub
With Range("A1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
With Range("A10")
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
End With
Exit For
End If
Next oPic
End With
With Range("J1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
With Range("J10")
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
End With
Exit For
End If
Next oPic
End With
End Sub
It does not work with cell J1. I am not sure what do i have to do to make it work. I want both pictures to show up when two different values are selected in those two cells.
Thanks
Asad
Last edited: