- 帖子
- 17
- 主題
- 4
- 精華
- 0
- 積分
- 67
- 點名
- 0
- 作業系統
- Win7 & Win10
- 軟體版本
- Office 2003 & Office 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2020-2-4
- 最後登錄
- 2024-4-19
|
vba 如何修改新增公式 可以自動貼下一排
想要貼滿5個後,換下一排在貼5個....以此類推
請幫幫我!!
公式如下:
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 = Application.ActiveCell.Column
If IsArray(PicList) Then
xRowIndex = Application.ActiveCell.Row
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, Rng.Width, Rng.Height)
xColIndex = xColIndex + 1
Next
End If
End Sub |
|