I am working on an unserform, which allows the user to insert pictures into specific cells as attachments. So far, one button is responsible for one picture for one specific cell. I was wondering if it was possible to click one button multiple times, inserting multiple pictures into multiple cells, changing the position of the next picture depending on the number of pictures already inserted.
This is the code I am using for one button to insert one picture into a single specific cell of a worksheet:
Private Sub CommandButtonUpload_Click()
Dim PicLoad As Variant
PicLoad = Application.GetSaveAsFilename
Dim PicPath As String, Pic As Picture, ImageCell As Range
PicPath = PicLoad
Set ImageCell = Worksheets("Example").Range("a62")
Set Pic = Worksheets("Example").Pictures.Insert(PicPath)
With Pic
.ShapeRange.LockAspectRatio = msoTrue
.Left = ImageCell.Left
.Top = ImageCell.Top
End With
End Sub