楊菘峻Excel+VBA程式設計
107Excel
108Excel
我的Excel試算表
楊菘峻 Shift+Tab Shift 變速檔 Shift gear preserve=保留 左Shift+Tab 右邊Tab gear齒輪 Enter 計算 註解 shift 改變 shift 連續 16384 =COLUMN(天涯海角) Alt Ctrl 多重選擇 1048576 =ROW(天涯海角) Alternative 另一個選擇 control 16384 =POWER(2,14) ctrl 往上 1048576 =POWER(2,20) ctrl 往左 ctrl 往右 X24 16224 ctrl 往下 F6 156 楊 =LEFT(天涯海角,1) D4 4 楊菘 =LEFT(天涯海角,2) 16384 =SUM(D8:D10) 菘峻 =RIGHT(天涯海角,2) 重選 =MID(B5,2,2)我的ExcelVBA首次學習
pre = 保留原來字<--> 變數variables應該要宣告 pre=preserve保留 Option Explicit '要求所有變數必須宣告才能使用 Dim i, j As Integer Dimension 宣告指令 Public Sub 楊菘峻() Cells(1, 1).Value = "楊菘峻學習VBA" Cells(1, 1).Font.Size = 20 Cells(1, 1).Font.Color = (256,0,0) End Sub Public Sub 孫悟空() For i = 2 To 7 For j = 1 To 6 Cells(i, j).Value = i * j Cells(i, j).Font.Color = RGB(0,0,255) Cells(i, j).Font.Bold = True Next Next End SubExcelVBA雙迴圈
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 SubJavaScript迴圈
結果
JavaScript雙迴圈
結果
EXCEL巨集畫圖
'拷貝自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 = 180 ' points Sub 楊菘峻() Dim Shp As Shape Dim TLCleft As Double 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 End Sub Sub 刪除() For Each Shp In ActiveSheet.Shapes 'Shp 共用的物件宣告成全域變數 Shp.Delete Next End Sub劉任昌觀點
留言
張貼留言