標題:
[發問]
ActiveSheet.Shapes.AddPicture 位置改成變數該如何寫?
[打印本頁]
作者:
morris_lth
時間:
2015-12-24 17:41
標題:
ActiveSheet.Shapes.AddPicture 位置改成變數該如何寫?
ActiveSheet.Shapes.AddPicture (Picname), msoTrue, msoTrue, [D1].Left, [A2].Top, 5 / 0.035, 1.2 / 0.035
請問一下上述指令中的[A2]的2,我想改成變數I,該怎嚜寫? 一直沒試成功....
作者:
yen956
時間:
2015-12-24 18:02
Cells(I, "A")
作者:
c_c_lai
時間:
2015-12-24 19:41
本帖最後由 c_c_lai 於 2015-12-24 19:44 編輯
回復
1#
morris_lth
Sub Ex()
Dim rngA As Range, rngB As Range, c1 As Long, c2 As Long
Set rngA = [D1]
Set rngB = [A2]
ActiveSheet.Shapes.AddPicture (ThisWorkbook.Path & "\c.png"), msoTrue, msoTrue, rngA.Left, rngB.Top, 5 / 0.035, 1.2 / 0.035
c1 = 1: c2 = 15
ActiveSheet.Shapes.AddPicture ThisWorkbook.Path & "\c.png", msoTrue, msoTrue, Range("D" & c1).Left, Range("A" & c2).Top, 5 / 0.035, 1.2 / 0.035
End Sub
複製代碼
[attach]22965[/attach]
作者:
morris_lth
時間:
2015-12-25 13:26
原來是這樣,謝謝大家
我基礎不好,有時GOOGLE不到答案,常常麻煩各位先進.....謝謝
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)