Hello everyone,
Patience with the newbie please. I've been able to find lot's of VBA help here over the years, and am completely stumped with my new task and need help.
I have a model, powered by VBA, that runs multiple iterations. Each iteration results in an output like: (the 9 data cells change each iteration. Companies and headers stay the same)
[TABLE="width: 269"]
<tbody>[TR]
[TD]Company[/TD]
[TD] Cost[/TD]
[TD] Profit[/TD]
[TD] Margin[/TD]
[/TR]
[TR]
[TD]Company A[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10%[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]11%[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]15%[/TD]
[/TR]
</tbody>[/TABLE]
I need to capture each iteration as a row (sample margin %'s are rounded...I know):
[TABLE="width: 780"]
<tbody>[TR]
[TD="align: center"]Iteration[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]90[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]11%[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]40[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]15%[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]60[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]13%[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]85[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]11%[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]75[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]8%[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]65[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]12%[/TD]
[/TR]
</tbody>[/TABLE]
Rather than copy / paste each row of the iteration into another area, I'd like to capture all the data in an array. Each new iteration would build a new row in the array. If I run 10 iterations, I would want to output the final array of 10 data rows and 13 columns. (The real set of iteration data in the model has about 100 rows and 25 columns, running 5,000 iterations.)
I hope this makes sense.
Any help with VBA code to build and output this array would be of enormous help.
Thanks!
jkguy
Patience with the newbie please. I've been able to find lot's of VBA help here over the years, and am completely stumped with my new task and need help.
I have a model, powered by VBA, that runs multiple iterations. Each iteration results in an output like: (the 9 data cells change each iteration. Companies and headers stay the same)
[TABLE="width: 269"]
<tbody>[TR]
[TD]Company[/TD]
[TD] Cost[/TD]
[TD] Profit[/TD]
[TD] Margin[/TD]
[/TR]
[TR]
[TD]Company A[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10%[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]11%[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]15%[/TD]
[/TR]
</tbody>[/TABLE]
I need to capture each iteration as a row (sample margin %'s are rounded...I know):
[TABLE="width: 780"]
<tbody>[TR]
[TD="align: center"]Iteration[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[TD="align: center"]Company[/TD]
[TD="align: center"]Cost[/TD]
[TD="align: center"]Profit[/TD]
[TD="align: center"]Margin[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]90[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]11%[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]40[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]15%[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]60[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]13%[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]85[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]11%[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]75[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]8%[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]65[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]12%[/TD]
[/TR]
</tbody>[/TABLE]
Rather than copy / paste each row of the iteration into another area, I'd like to capture all the data in an array. Each new iteration would build a new row in the array. If I run 10 iterations, I would want to output the final array of 10 data rows and 13 columns. (The real set of iteration data in the model has about 100 rows and 25 columns, running 5,000 iterations.)
I hope this makes sense.
Any help with VBA code to build and output this array would be of enormous help.
Thanks!
jkguy