Hi all
I have several pictures on my sheet one being the header the other inserts into J6
When D2 has specific text a corresponding picture appears in J6, As D2 changes the picture is deleted and a new picture inserted into J6
The code below deletes all pictures from the sheet than updates J6 including the header
I want the header picture to stay always
i have tried many different things but still deletes all
Any help is greatly appreciated
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim myPict As Picture
Dim PictureLoc As String
If Target.Address = Range("D2").Address Then
ActiveSheet.Pictures.Delete.myPict
PictureLoc = "C:\Users\dmott\Desktop\TEMP PICS EXCEL\" & Range("D2").Value & ".png"
With Range("J6")
Set myPict = ActiveSheet.Pictures.Insert(PictureLoc)
myPict.Top = .Top
myPict.Left = .Left
myPict.ShapeRange.LockAspectRatio = msoFalse
myPict.Placement = xlMoveAndSize
myPict.ShapeRange.Width = 250
myPict.ShapeRange.Height = 168
End With
End If
End Sub
Bookmarks