I found this great, simple, code online that inserts images into a spreadsheet. The only problem is that the code inserts the images down a column or across a row. I'd like to insert images in a grid (2x2 or 3x3 per page for example) so that when I print it creates a nice report. I have hundreds of images to print and would like to save on paper. here's the code. Any ideas?
Sub InsertPictures()
'Update 20140513
Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = 1
If IsArray(PicList) Then
xRowIndex = 1
For lLoop = LBound(PicList) To UBound(PicList)
Set Rng = Cells(xRowIndex, xColIndex)
Set sShape = ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, 40, 30)
xRowIndex = xRowIndex + 1
Next
End If
End Sub
Sub InsertPictures()
'Update 20140513
Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = 1
If IsArray(PicList) Then
xRowIndex = 1
For lLoop = LBound(PicList) To UBound(PicList)
Set Rng = Cells(xRowIndex, xColIndex)
Set sShape = ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, 40, 30)
xRowIndex = xRowIndex + 1
Next
End If
End Sub