Option Explicit
Sub JpgInsert()
Dim Mypath As String, E As Range, x%, y% ', MyPic As Object
Mypath = "D:\JPG\"
Application.ScreenUpdating = False
With Sheets("Sheet1")
.Pictures.Delete '§R°£¥þ³¡¹Ï¤ù
For y = 0 To 9
For x = 0 To 2
Set E = Cells(5 + 8 * y, 1 + x * 3)
' E.Resize(8).ColumnWidth = 30 '½Õ¾ãÀx¦s®æ¼e«×
' E.Resize(8).RowHeight = 20 '½Õ¾ãÀx¦s®æ°ª«×
If Dir(Mypath & E(2, 2) & ".jpg") <> "" Then
'Set MyPic = ActiveSheet.Pictures.Insert(Mypath & E & ".jpg")
With .Pictures.Insert(Mypath & E(2, 2) & ".jpg")
.ShapeRange.LockAspectRatio = msoFalse '¹Ï§Î¤ñ¨Ò msoTrue / msoFalse=¶ñº¡®æ
.Left = E.Resize(8).Left
.Top = E.Resize(8).Top
.Width = E.Resize(8).Width '=Àx¦s®æ¼e«×
.Height = E.Resize(8).Height '=Àx¦s®æ°ª«×
End With
End If
Next
Next
End With
Application.ScreenUpdating = True
End Sub