I wish to speed up my Monte Carlo simulation. I'm reading that dumping values generated by a loop into a VBA array, versus into Excel itself, followed by then dumping the completed array into Excel cells (if I need those values, which I do) is much faster. I've been reading about arrays all morning and I can't wrap my head around it. I believe that I want to create a two-dimensional array that copies a single row of live values and then pastes the value in 'iterations' number of rows. Then take that two dimensional array and paste it back into Excel. Am I thinking about this correctly? I've pasted my dysfunctional code below - what I'm getting is a "Subscript out of Range" error.
Dim Iterations As Long
Dim i As Long
Iterations = 10000
Dim Results As Variant
Results = Sheets("Probabilistic Sensitivity").Range("E18:CO" & Iterations).Value
For i = 1 To Iterations
Run Sheets("Calculation").Calc 'Separate, simple macro
Results(i, 0).Offset(i - 1).Value = Sheets("Probabilistic Sensitivity").Range("E6:CO6").Value
DoEvents
Next i
Range("E18:CO" & Iterations) = Results
Dim Iterations As Long
Dim i As Long
Iterations = 10000
Dim Results As Variant
Results = Sheets("Probabilistic Sensitivity").Range("E18:CO" & Iterations).Value
For i = 1 To Iterations
Run Sheets("Calculation").Calc 'Separate, simple macro
Results(i, 0).Offset(i - 1).Value = Sheets("Probabilistic Sensitivity").Range("E6:CO6").Value
DoEvents
Next i
Range("E18:CO" & Iterations) = Results