.
This macro comes close and hopefully you can use it.
Option Explicit
Sub ChangeImage()
Application.ScreenUpdating = False
With Range("A1")
ActiveSheet.Pictures.Delete
End With
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Object
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
With Range("A1")
img.Top = .Top
img.Width = 50
img.Height = 50
img.Left = .Left
img.Placement = xlMoveAndSize
End With
Else
MsgBox ("Cancelled.")
End If
End With
Application.ScreenUpdating = True
End Sub
Instead of clicking the image, you will need to place a command button next to the image for the user to click.
The routine will clear ALL images on the sheet prior to inserting the new image into the frame. If you have more than one image on the sheet - all images will be affected by the deletion.
Bookmarks