try
Sub Add_Picture()
Dim xlRng As Range
Dim Picture1$
'Chris Swier
'Unprotect sheet and turn screen updating off
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Set xlRng = Selection
'Find picture
Picture1 = Application.GetOpenFilename("Picture,*.JPG,Picture,*.JPEG,Picture,*.GIF,Picture,*.BMP")
'edit "("Picture,*.*")" section to add or change visible file types
'Insert picture into active cell
ActiveSheet.Pictures.Insert(Picture1).Select
With Selection.ShapeRange
.LockAspectRatio = msoFalse
If .Width > .Height Then
.Width = xlRng.Width
If .Height > xlRng.Height Then .Height = xlRng.Height
Else
.Height = xlRng.Height
If .Width > xlRng.Width Then .Width = xlRng.Width
End If
End With
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
'Remove picture link and insert picture file
Selection.CopyPicture
Selection.Delete
ActiveSheet.Paste
'Reprotect sheet and turn screen updating back on
Application.ScreenUpdating = True
ActiveSheet.Protect
End Sub
Bookmarks