你嘗試過什麼嗎?這是一種方法。
Sub x()
Dim array1, array2() As Long, i As Long, j As Long, k As Long
array1 = Range("A1").CurrentRegion.Value 'array1 populated from sheet, but could be via code
ReDim array2(1 To UBound(array1, 1), 1 To UBound(array1, 2))
For i = LBound(array1, 1) To UBound(array1, 1)
k = k + 1
For j = LBound(array1, 2) To UBound(array1, 2)
array2(i, j) = Application.Sum(Application.Index(array1, Evaluate("ROW(1:" & k & ")"), j))
Next j
Next i
Range("I1").Resize(UBound(array2, 1), UBound(array2, 2)).Value = array2
End Sub
來源
2017-11-25 14:40:41
SJR
Thx我從這段代碼開始,它工作的很棒! – JHS