我想寫一個巨集陣列的程式,條件如下:
從工作表"Shipping formula.xlsm"的Sheet("Signed") copy一個圖片"Picture 1",分別貼到
"Shipping for ACE.xlsx"的Sheet("PKG","INV","SCD"),
貼的位置為Sheet("PKG")......D欄位的"TOTAL N. W."字樣+右12格
Sheet("INV")......Q欄位的"B. C. MART COMPANY LTD."字樣+下2格
Sheet("SCD")......B欄位的"Signature:"字樣+右2格
簽名檔"Picture 6"放在"Shipping formula.xlsm"的Sheets("Signed"),
我想將簽名copy到("Accounting_Rising.xlsx").Sheets("INV")的P欄"RISING STAR COMPANY LTD."向下2格.
以下是我的寫法,但一直無法運作,可否幫忙看看語法哪裡有誤?
Windows("Shipping formula.xlsm").Activate
Sheets("Signed").Select
ActiveSheet.Shapes.Range(Array("Picture 6")).Select
Selection.Copy
With Workbooks("Accounting_Rising.xlsx").Sheets("INV").[P:P].Find("RISING STAR COMPANY LTD.").Offset(2, 0).Activate
ActiveSheet.Paste
End With作者: GBKEE 時間: 2012-10-9 14:54
請問這個程式若改為只貼在一個sheet( INV),而不是貼3個sheet, 我將他改為以下,雖可以執行,但原先你幫我寫的是陣列,現在改這樣好像有點複雜化了,我可以怎麼修正呢?
Dim Rng(1 To 1) As Range, xi As Integer
Workbooks("Shipping formula.xlsm").Sheets("Signed").Pictures("Picture 1").Copy
With Workbooks("Shipping for Courier.xlsx")
.Activate
Set Rng(1) = .Sheets("INV").[R:R].Find("B. C. MART COMPANY LTD.").Offset(3, 0)
For xi = 1 To 1
Rng(xi).Parent.Activate
Rng(xi).Activate
ActiveSheet.Paste
Next
End With作者: GBKEE 時間: 2012-10-13 07:36
Sub change_Signed()
'Dim Rng(1 To 3) As Range, xi As Integer
With Workbooks("Shipping formula-2.xlsm").Sheets("Signed")
For xi = 1 To .Pictures.Count
.Pictures(xi).Name = "簽名" & xi
Next
End With
Rng(xi).Parent.Pictures.Delete '刪除 Rng(xi)父層(工作表)的圖片
Rng(xi).PasteSpecial
End Sub作者: PJChen 時間: 2012-10-13 12:10
Sub try()
Dim Rng As Range
Workbooks("Shipping formula.xlsm").Sheets("Signed").Pictures("簽名2").Copy
With Workbooks("Shipping for Courier.xlsx")
.Activate
Set Rng = .Sheets("PKG").[D:D].Find("TOTAL N. W.", LOOKAT:=xlPart).Offset(0, 11)
If Not Rng Is Nothing Then
With Rng
.Parent.Activate 'Worksheet
.Activate 'Range
End With
ActiveSheet.Paste
End If
End With
End Sub作者: GBKEE 時間: 2012-10-13 13:14