Option Explicit Const ksFactor As Double = 0.177346958265686 Const knMaxWidth As Long = 100 Sub Main() Dim pic As Picture For Each pic In Sheet1.Pictures pic.Delete Next pic Sheet1.UsedRange.Clear Dim row As Long Dim col As Long Dim dirName As String With Application.FileDialog(msoFileDialogFolderPicker) .Title = "Choose a directory" .Show If .SelectedItems.Count = 0 Then End dirName = .SelectedItems(1) End With Dim nFile As Long Dim sFile As String Dim sFiles() As String sFile = Dir(dirName & "\*.jpg") Do While Len(sFile) > 0 nFile = nFile + 1 ReDim Preserve sFiles(1 To nFile) sFiles(nFile) = sFile sFile = Dir Loop Dim nWidth As Long Dim nHeight As Long nWidth = Int(Sqr(nFile)) nHeight = Int(nFile / nWidth) If nWidth * nHeight < nFile Then nHeight = nHeight + 1 Dim nCount As Long nCount = 0 For row = 1 To nHeight Dim nMaxHeight As Long nMaxHeight = 0 For col = 1 To nWidth If nCount < nFile Then nCount = nCount + 1 Dim picCurrent As Picture Set picCurrent = Sheet1.Pictures.Insert(sFiles(nCount)) picCurrent.Top = Sheet1.Cells(row, col).Top picCurrent.Left = Sheet1.Cells(row, col).Left Dim nPicWidth As Double Dim nPicHeight As Double nPicWidth = picCurrent.Width nPicHeight = picCurrent.Height If nPicWidth > knMaxWidth Then picCurrent.Width = knMaxWidth picCurrent.Height = knMaxWidth / nPicWidth * nPicHeight End If nMaxHeight = Application.Max(picCurrent.Height, nMaxHeight) Sheet1.Cells(row, col).Value = sFiles(nCount) If row = 1 _ Or Sheet1.Columns(col).ColumnWidth < picCurrent.Width * ksFactor Then Sheet1.Columns(col).ColumnWidth = picCurrent.Width * ksFactor End If End If Next col Sheet1.Rows(row).RowHeight = nMaxHeight + 11.75 Next row For col = 1 To nWidth Sheet1.Columns(col).ColumnWidth = Sheet1.Columns(col).ColumnWidth + 1 Next col End Sub