Option Explicit
Sub Picture()
Application.ScreenUpdating = False
Range("A6").Select 'This is where picture will be inserted
ActiveSheet.Pictures.Insert("C:\Users\My\Desktop\cute-red-kitten-forgot-something-r-default.jpg").Select
'Path to where pictures are stored - Edit as required
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This resizes the picture
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Selection
.Left = Range("A6").Left '<--- change cell as required
.Top = Range("A6").Top '<--- change cell as required
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 100#
.ShapeRange.Width = 100#
.ShapeRange.Rotation = 0#
End With
Exit Sub
ErrNoPhoto:
MsgBox "Unable to Find Photo" 'Shows message box if picture not found
Exit Sub
Application.ScreenUpdating = True
End Sub
Sub deleteImage()
Dim Pict As Shape
Dim Cel As Range
Set Cel = Sheets("Sheet1").Range("A6")
Dim Caddress As String
Caddress = Cel.Address
Application.ScreenUpdating = False
For Each Pict In Sheets("Sheet1").Shapes 'Check for each picture in the range
If Pict.Type = msoPicture Then
If Pict.TopLeftCell.Address = Caddress Or Pict.BottomRightCell.Address = Caddress Then
Pict.Delete
Exit Sub
Else:
MsgBox "Doesn't exists a picture in the range"
Exit Sub
End If
End If
Next Pict
Application.ScreenUpdating = True
End Sub