title: Can't cumulate the sum of array elements with VBA
body: <p>I'm trying to cumulate the sums of values in an excel column of 4 values dimension (4,1). </p>
  
  <p>So, I constructed the code below. For the first row in a column on the side Result, it is supposed to hold the same value as in the original Array. 
  But then, once it is greater than the first row, it is supposed to get the previous element of result (i-1) and add to it the current column element (i). </p>
  
  <p>VBA is telling me that the subscript is out of range :/ and I cant figure out why... so I dont even know if my code does what I want. </p>
  
  <pre><code>Sub CumulativeSum()
      Dim i As Integer
      Dim j As Integer
      Dim rColumn() As Variant
      Dim result() As Variant
      ReDim result(1 To 4)
      rColumn = Worksheets("Sheet1").Range("E1:E4").Value2
  
      For i = 1 To 4
          result(1) = rColumn(1, 1)
          For j = 2 To 3
              result(j) = rColumn(j, 1) + result(j - 1)
          Next j
     Next i
     Dim dest As Range
     Set dest = Worksheets("Sheet1").Range("F1")
     dest.Resize(4, 1).Value = result
  End Sub
  </code></pre>