'A1セルに入力したのファルダ、または、C:\My Documents\My Pictures内のJPG・gif画像を全て挿入します Dim i As Integer, j As Integer, k As Integer, m As Integer, N As String Dim PathName As String, BookName As String Sub 画像の一括挿入() Application.ScreenUpdating = False '画面の動きを固定 Sheets("写真一覧").Select ActiveSheet.DrawingObjects.Delete On Error GoTo Errorline i = Application.InputBox(Prompt:="横に何枚並べますか?", Default:=5, Type:=1) Cells.RowHeight = 30 Cells.ColumnWidth = 18 j = 2: k = 2 Call セル横幅調整 If Range("A1") <> "" Then N = Range("A1").Value Else N = "C:\My Documents\My Pictures\" End If PathName = Application.InputBox(Prompt:="表示する画像の入ったフォルダのフルパスを入力してください", _ Default:=N, Type:=2) BookName = PathName & Dir(PathName & "*.jpg") Call 画像挿入 BookName = PathName & Dir(PathName & "*.gif") Call 画像挿入 Errorline: ActiveSheet.Buttons.Add(507.75, 6, 69, 18).Select With Selection .OnAction = "プリクラ.xls!画像の一括挿入.画像の一括挿入" .Name = "画像挿入ボタン" .Characters.Text = "画像挿入" .Placement = xlMove End With Range("A1").Select Application.ScreenUpdating = True End Sub Private Sub 画像挿入() Do Until BookName = PathName & "" ActiveSheet.Pictures.Insert(BookName).Select With Selection .Left = Cells(j, k).MergeArea.Left .Top = Cells(j, k).MergeArea.Top .Height = Cells(j, k).MergeArea.Height .Width = Cells(j, k).MergeArea.Width End With k = k + 2 If k > i * 2 Then k = 2 j = j + 2 Rows(j - 1).RowHeight = 18 Rows(j).RowHeight = 80 End If BookName = PathName & Dir() Loop End Sub Private Sub セル横幅調整() For m = 2 To i * 2 Step 2 Columns(m - 1).ColumnWidth = 1 Next Rows("2").RowHeight = 80 End Sub