title: How to fill a range with values that are dependent on the previous value?
body: <p>'I'm attempting to fill a named range with revenue. The first cell of the named range already has a value and represents the current year (year 0) of revenue. I want to use a random stochastic process to forecast year 1's revenue by using year 0's revenue. And then forecast year 2's revenue by using year 1's revenue. My problem is that all the cells of the range are receiving the beginning revenue value of year 0.</p>
  
  <pre><code>Sub RevenuePathSimulation()
  
  Range("starttime") = Time
  Dim RR As Variant
  RR = Array()
  
  Dim N As Double
  N = Range("runs").Value
  Dim years As Double
  years = Range("RevRng").Count
  Dim mean As Long
  mean = Range("mean")
  Dim sigma As Long
  sigma = Range("sigma")
  Dim i As Integer
  Dim j As Integer
  
  For j = 2 To years
      RR(1, j) = RR(1, j - 1) * Exp(mean + sigma * Rnd())
      Range("RevRng").Value = RR(1, j)
      Debug.Print RR(1, j)
  Next j
  Range("stoptime") = Time
  
  End Sub
  
      ' The end result is to have revenues for years 0 to 10
      ' derived from a random stochastic process.
  </code></pre>