J
JT
Hello team!
I wonder if anybody could help me with the following problem:
I have a macro which creates a 5x52 array of data for each year in a
50 year period. This gives me a 5x52x50 array overall which has been
named "rngArray1".
I need some code to paste one year's worth of data into excel in one
go. At the moment I have the following:
*******************************
intYear = 1 '(To paste the data for year 1 in my timeline)
For j = 1 To 5
For k = 1 To 52
Sheets("By Cohort").Cells(j, k) = rngArray1(j, k, intYear)
Next j
Next i
*******************************
My problem is that looping through and pasting one element of the data
at a time like this takes a long time, and is prohibitively slow when
I need to repeat this process hundreds of times.
If my array was 2D then I would find it very easy to drop the data
into excel in one step without having to use a loop. However, I'm
having trouble doing this with a 3D array. I can't seem to find a way
of pasting only the desired cross section in one go.
I hope this is clear. I'd really appreciate any help so get in touch
if you'd like me clarify anything.
Thanks
John
I wonder if anybody could help me with the following problem:
I have a macro which creates a 5x52 array of data for each year in a
50 year period. This gives me a 5x52x50 array overall which has been
named "rngArray1".
I need some code to paste one year's worth of data into excel in one
go. At the moment I have the following:
*******************************
intYear = 1 '(To paste the data for year 1 in my timeline)
For j = 1 To 5
For k = 1 To 52
Sheets("By Cohort").Cells(j, k) = rngArray1(j, k, intYear)
Next j
Next i
*******************************
My problem is that looping through and pasting one element of the data
at a time like this takes a long time, and is prohibitively slow when
I need to repeat this process hundreds of times.
If my array was 2D then I would find it very easy to drop the data
into excel in one step without having to use a loop. However, I'm
having trouble doing this with a 3D array. I can't seem to find a way
of pasting only the desired cross section in one go.
I hope this is clear. I'd really appreciate any help so get in touch
if you'd like me clarify anything.
Thanks
John