이것은 제가 지금까지 가지고있는 것입니다. 나는 10 열 뒤의 그림을 어떻게 되돌려 놓을 지 알 수 없습니다.그림을 10 개만 만들려고합니다. 줄을 아래로 돌리면 다음 줄로 되돌아갑니다. 누구든지 나를 도울 수 있습니까?
Sub InsertPictures()
Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
Dim MaxWidth#
On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = Application.ActiveCell.Column
If IsArray(PicList) Then
xRowIndex = Application.ActiveCell.Row
For lLoop = LBound(PicList) To UBound(PicList)
Set Rng = Cells(xRowIndex, xColIndex)
With ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, -1, -1)
.LockAspectRatio = True
.Height = 100 * 3/4
Rng.RowHeight = .Height
If MaxWidth < .Width Then
MaxWidth = .Width
End If
End With
xRowIndex = xRowIndex + 1
Next
Rng.ColumnWidth = MaxWidth/Rng.Width * Rng.ColumnWidth
Rng.ColumnWidth = MaxWidth/Rng.Width * Rng.ColumnWidth
Rng.ColumnWidth = MaxWidth/Rng.Width * Rng.ColumnWidth
For Each sShape In ActiveSheet.Shapes
sShape.Left = MaxWidth/2 - sShape.Width/2
Next
End If
End Sub
감사 크리스! 나는 내가 게시 한 후에 그것을 알아 냈다. 처음으로 사용자, 실수로 유감스럽게 생각합니다. –