Thanks you for reply and for you help. But I don't where I can add the code. I try to the code based on reply but the picture not proportion. like this below
Screen Shot 2019-03-21 at 11.53.45 PM.jpg
The Code i like this. Set shp = Me.Shapes.AddPicture(filepath & Target & ".jpg", msoFalse, msoTrue, .Left, .Top, .Width / 2, .Height)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim shp As Shape
Dim addr As Variant
Dim hPictureLocations As Variant
Dim i As Long
Dim lastRow As Long
Const filepath As String = "D:\royal_plaza_wincash\" '* this is my test folder
'Const filepath As String = "C:\Users\drawing\Desktop\New folder\"
'Const filepath As String = "X:\Miscellany\" 'How I tested
lastRow = WorksheetFunction.Max(11, ActiveSheet.Cells(Rows.Count, "C").End(xlUp).Row)
If Not Intersect(Target, Range("C2:C" & lastRow)) Is Nothing Then
If Dir(filepath & Target & ".jpg") <> "" Then '* verify that the file exists
Application.ScreenUpdating = False
Application.EnableEvents = False
With Target.Offset(0, -1)
On Error Resume Next
Me.Shapes("PictureAt" & .Address).Delete
On Error GoTo 0
Set shp = Me.Shapes.AddPicture(filepath & Target & ".jpg", msoFalse, msoCTrue, .Left, .Top, .Width, .Height)
shp.Name = "PictureAt" & .Address
End With
End If
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
If Not Intersect(Target, Range("C2:C" & lastRow)) Is Nothing Then
With Target.Offset(0, -1)
On Error Resume Next
Me.Shapes("PictureAt" & .Address).Delete
Err.Clear
On Error GoTo 0
If Dir(filepath & Target & ".jpg") <> "" Then
Set shp = Me.Shapes.AddPicture(filepath & Target & ".jpg", msoFalse, msoTrue, .Left, .Top, .Width / 2, .Height)
shp.Name = "PictureAt" & .Address
GoSub setShapeSize
Else
If Dir(filepath & NOPHOTO & ".jpg") <> "" Then
Set shp = Me.Shapes.AddPicture(filepath & "NOPHOTO.jpg", msoFalse, msoCTrue, .Left, .Top, .Width, .Height)
shp.Name = "NOPHOTO"
GoSub setShapeSize
Else
With Target.Offset(0, -1)
.Value = "NO PHOTO" & Chr(10) & "AVAILABLE"
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
End With
End If
End If
End With
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
Exit Sub
setShapeSize:
With shp
' .LockAspectRatio = msoTrue
' .Top = Target.Offset(0, -1).Top / 2
' .Left = Target.Offset(0, -1).Left
' .Width = Target.Offset(0, -1).Width / 2
' .Height = Target.Offset(0, -1).Height / 2
' ' shp.ScaleHeight 1.75, msoFalse
End With
Return
End Sub