楊閺霖VBA雙迴圈Loop與JavaScript迴圈
VBA繪圖
VBA繪圖程式碼
'拷貝自https://excelatfinance.com/xlf19/xlf-...
'Dr Ian O'Connor, CPA. - located in Victoria, Australia.
Option Explicit
Const topleft As String = "C5" ' anchor cell
Const diam As Integer = 100 ' points
Dim Shp As Shape '全域變數global variables 每一個副程式都可以用
Sub 楊閺霖()
Dim TLCleft As Double '區域local variables只能用在這裡
Dim TLCtop As Double
Dim i As Integer
For i = 1 To 30
TLCleft = 20 * i
TLCtop = 20 * i
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
Next
With Cells(1, 1) '物件.字物件 屬性 方法
.Value = "楊閺霖"
.Interior.Color = RGB(200, 200, 0)
With .Font
.Size = 20
.Color = RGB(255, 255, 255)
.Bold = True
End With
End With
End Sub
Sub 楊閺霖刪除() '在113影片下有程式碼
For Each Shp In ActiveSheet.Shapes
Shp.Delete '將使用中active的工作表sheet的每個圖形shape刪除
Next
End Sub
楊閺霖觀點
劉任昌112影片
JavaScript雙迴圈
輸出
EXCEL VBA雙迴圈
Option Explicit '必須宣告所有變數variables
Dim i, j As Integer '宣告dimension i, j 是整數integer
Public Sub 楊閺霖()
Cells(1, 1).Value = "楊閺霖"
Cells(1, 1).Font.Size = 20
Cells(1, 1).Interior.Color = RGB(128, 0, 0)
Cells(1, 1).Font.Color = RGB(255, 255, 255)
End Sub
Public Sub 楊閺霖迴圈()
For i = 2 To 10
For j = 1 To 6
Cells(i, j).Value = (2010 + i) & "年" & j & "月"
Next
Next
End Sub
RGB顏色控制
檔案前頭程式碼
<style> h1{text-align: center;padding: 20px; background: #890089; color: #FFFFFF; }
</style>
<script>
function year()
{ var tmp="<font size=5>" ;//宣告一個字串變數tmp
for (var i=2010; i<2022; i++)
tmp = tmp + i +"年<br>";
tmp = tmp + "</font>"
document.getElementById("out").innerHTML = tmp;
}
</script>
<h1>JavaScript雙迴圈</h1>
<input type="button" value="劉任昌年" onclick="year()">
<p id="out">輸出</p>
留言
張貼留言