劉任昌EXCEL VBA雙迴圈JavaScript迴圈VBA AddShape
VBA迴圈畫圖 >VBA迴圈畫圖程式碼 Rem https://excelatfinance.com/xlf19/xlf-qg-add-blue-circle.php Rem 2021/11/29劉任昌提示 Option Explicit Const topleft As String = "C5" ' anchor cell Const diam As Integer = 100 ' 宣告常數constant變數diameter直徑radius半徑 Dim Shp As Shape '宣告變數Shp是 圖形 全域變數global 非區域變數local variables Sub 劉任昌刪除() For Each Shp In ActiveSheet.Shapes Shp.Delete '刪除使用中試算表ActiveSheet的所有圖形Shapes Next End Sub Sub 劉任昌() Dim x As Double '宣告變數x是倍精度實數Double Dim y As Double '宣告變數y是倍精度實數Double Dim i As Integer '宣告變數i是整數Double For i = 1 To 10 '寫迴圈 x = 20 * i y = 20 * i '往下的方向出現物件addshape增加圖形type mso微軟office Set Shp = ActiveSheet.Shapes.AddShape(msoShapeOval, x, y, 30,60) With Shp .Fill.Visible = msoFalse .Line.Weight = 10 .Line.ForeColor.Brightness = 0.4 .ThreeD.BevelTopType = msoBevelCircle End With Next With Cells(1, 1) .Value = "劉任昌" '在儲存格1,1放入字串string .Interior.Color = RGB(0, 0, 255) ...