Sub InsertPicsIntoCells(ByVal rCll As Range)
Const dPadding As Double = 4
Dim n As Long, dLeft As Double, dTop As Double, dPicWidth As Double, dPicHeight As Double
Set rCll = rCll.Cells(1, 1).MergeArea
With Application.FileDialog(msoFileDialogFilePicker)
If Len(InitialPath) > 0 Then .InitialFileName = InitialPath
.Filters.Clear
.Filters.Add "Pictures", "*.jpg, *.jpeg"
.AllowMultiSelect = True
If .Show Then
n = .SelectedItems.Count
dLeft = rCll.Left
dTop = rCll.Top
dPicWidth = (rCll.Width - dPadding * (n + 1)) / n
dPicHeight = rCll.Height - dPadding * 2
For i = 1 To n
rCll.Parent.Shapes.AddPicture .SelectedItems(i), msoFalse, msoCTrue, dLeft + dPadding * i + dPicWidth * (i - 1), dTop + dPadding, dPicWidth, dPicHeight
Next
End If
End With
End Sub
Sub Test()
InsertPicsIntoCells Selection
End Sub