I am looking to read in a range consisting of a single row on cells A1:G1
into an array with 10 rows and then output the results on the same sheet in cells A2:G11
. The data in the input row changes as it is based on formulas containing random numbers. I'm told that the fastest way to do this is with an array. Not sure how to do that. So far I have the code shown below. This doesn't work because it won't recalculate the input data before it pastes it into the output cells so it keeps pasting the same values over and over. What is the best way to tackle this?
Sub MyRange()
Dim DataInput As Variant
Dim NumberOfSims As Long, i As Long
Application.Calculation = xlManual
NumberOfSims = 10
DataInput = Range("DataInput").Value
For i = 1 To NumberOfSims
Range(Cells(1 + i, "A"), Cells(1 + i, "g")).Value = DataInput
Application.Calculate
Next i
End Sub