看板 Visual_Basic 關於我們 聯絡資訊
請教一下各位,我在excel編輯VBA的程式,如果我自定一個函數, 如下面我自定一個SUM的函數,要如何將陣列中的值相加起來, 我FUNCTION定義的變數型態是不是錯了?? ======================================================= Sub g() Dim i As Integer Dim tempR(1 To 9) As Integer i = 2 tempR(2) = Array(10, 5, 9, 0, 0, 0, 0, 0, 0) Worksheets(1).Cells(10, 10).Value = sum(tempR(i)) End Sub Function sum(n) As Integer Dim p For p = 1 To 9 sum = sum + n Next p End Function -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.117.98.117