Try this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Me.Range("B3:B5")) Is Nothing Then
Me.Range(Target, "B6").ClearContents
End If
For i = 1 To 3
If Not Intersect(Target, Range("rngDisplayName" & i)) Is Nothing Then
InsertPicFromFile1 _
sFile:=Range("rngFileLocation" & i).Value, _
r:=Range("rngPicDisplayCells" & i), _
bFitH:=True, _
sPic:="MyDVPic" & i
End If
Next i
End Sub
Sub InsertPicFromFile(sFile As String, _
r As Range, _
bFitH As Boolean, _
sPic As String)
With r.Worksheet
On Error Resume Next
.Shapes(sPic).Delete
On Error GoTo 0
With .Pictures.Insert(Filename:=sFile)
If bFitH Then .Height = r.Height
.Left = r.Left + r.Width / 2 - .Width / 2
.Top = r.Top
.Name = sPic
End With
End With
End Sub
Bookmarks