廖妤涵EXCEL VBA雙迴圈JavaScript迴圈

VBA繪圖

VBA繪圖程式碼

Option Explicit
Const topleft As String = "C5"  ' anchor cell
Const diam As Integer = 100     ' points
Dim Shp As Shape  '宣告dim 變數Shp是圖形Shape  global

Sub 廖妤涵()
Dim TLCleft As Double 'local variables區域變數
Dim TLCtop As Double
 
        TLCleft = Range(topleft).Left
        TLCtop = Range(topleft).Top
 
        Set Shp = ActiveSheet.Shapes.AddShape(Type:=msoShapeOval, _
                                              Left:=TLCleft, Top:=TLCtop, _
                                              Width:=diam, Height:=diam)
        With Shp
                .Fill.Visible = msoFalse
                .Line.Weight = 10
                .Line.ForeColor.Brightness = 0.4
                .ThreeD.BevelTopType = msoBevelCircle
        End With
End Sub
Sub 廖妤涵()

Dim x As Double '宣告 x 是倍精度double
Dim y As Double '宣告 y 是倍精度double
Dim i As Integer '選告整數i
 For i = 1 To 20
        x = 20
        y = 20 * i
Set Shp = ActiveSheet.Shapes.AddShape(Type:=msoShapeOval, Left:=x, Top:=y, Width:=diam, Height:=diam)
        With Shp
                .Fill.Visible = msoFalse
                .Line.Weight = 10
                .Line.ForeColor.Brightness = 0.4
                .ThreeD.BevelTopType = msoBevelCircle
        End With
  Next
       With Cells(1, 1) 'with 固定前面的物件end with
                .Value = "廖妤涵"
                .Interior.Color = RGB(255, 127, 80)
                With .Font
                  .Size = 16
                  .Bold = True
                  .Color = RGB(255, 255, 255)
                End With
        End With
End Sub
Sub 刪除()
   For Each Shp In ActiveSheet.Shapes 'Shp 共用的物件宣告成全域變數
      Shp.Delete
   Next
End Sub

劉任昌113影片

劉任昌觀點

輸出

EXCEL迴圈

Public Sub 廖妤涵()
  Cells(1, 1).Value = "廖妤涵學習VBA"
  Cells(1, 1).Font.Color = RGB(0, 200, 200)
  Cells(1, 1).Font.Size = 20
End Sub
Public Sub abc()
  For i = 11 To 20
     Cells(i, 1).Value = i * i
  Next
End Sub
Public Sub 小可愛()
  For i = 2 To 10
    For j = 1 To 10
        Cells(i, j).Value = i * j
        Cells(i, j).Font.Color = RGB(200, 0, 200)
    Next
  Next
End Sub

JavaScript迴圈

<head>
<style>
  h1{padding: 20px; background-color: DarkOrange; color: white;}
</style>
<script>
function year()
  { var tmp ="<font size=5 color=#FF7F50>"; //輸出HTML指令preserve格式
   for (var i=0 ; i<= 5; i++)
   {  tmp = tmp + (i+2020) +"年";
      for (var j=1; j<13; j++)
      { tmp=tmp + j +"月";
      }
     tmp = tmp +"<br/>";
   }//tmp 是一個字串變數+進行字串的串接加上<br/>html換列命令
   tmp = tmp + "</font>";
   document.getElementById("out").innerHTML = tmp;
  }
</script>
</head>

<input onclick="year()" type="button" value="廖妤涵" />

網頁顏色

留言

這個網誌中的熱門文章

期貨、選擇權與其他衍生性商品2023年第二次 廖妤涵

期貨市場理論與實務2022Q3-廖妤涵