[font=Courier New][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] Worksheet_Change([color=darkblue]ByVal[/color] Target [color=darkblue]As[/color] Range)
[color=darkblue]If[/color] Target.Address <> "$A$1" [color=darkblue]Then[/color] [color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
[color=darkblue]Call[/color] DeletePic
[color=darkblue]If[/color] Target.Value <> "" [color=darkblue]Then[/color]
[color=darkblue]Dim[/color] strPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] strFile [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] objPic [color=darkblue]As[/color] Picture
[color=darkblue]Dim[/color] Pic [color=darkblue]As[/color] Picture
strPath = "C:\Users\Domenic\Documents\Pictures\" [color=green]'change the path accordingly[/color]
strFile = Target.Value & ".jpg"
[color=darkblue]If[/color] Dir(strPath & strFile) <> "" [color=darkblue]Then[/color]
[color=darkblue]Set[/color] objPic = Me.Pictures.Insert(strPath & strFile)
objPic.Top = Target.Offset(, 1).Top
objPic.Left = Target.Offset(, 1).Left
[color=darkblue]Else[/color]
MsgBox "Picture """ & Target.Value & ".jpg"" cannot be found!", vbExclamation
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] DeletePic()
[color=darkblue]Dim[/color] oPic [color=darkblue]As[/color] Picture
[color=darkblue]For[/color] [color=darkblue]Each[/color] oPic [color=darkblue]In[/color] Me.Pictures
[color=darkblue]If[/color] oPic.TopLeftCell.Address = "$B$1" [color=darkblue]Then[/color]
oPic.Delete
[color=darkblue]Exit[/color] [color=darkblue]For[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
[color=darkblue]Next[/color] oPic
End [color=darkblue]Sub[/color]
[/font]