Hi all,
I've build a simulation model. It would be really helpful if I had a macro that would allow me to run the model multiple times, and each time:
- Update the random values before calculations
- Save the results in a different column each time (as not to paste over the results from previous runs)
Here is the file: Monte Carlo Simulation.xlsm
In sheet UI cell A1 you'll find the number of runs (repeats). So essentially the macro should stop once it has run the model X number of times. The model itself runs by activating the Sub Run_Model() that is already in the file.
In cell B2 you'll find the seed increase. This value should be added to the seed values in cells C4, D4, E4 and F4 of sheet RANDOM. So after the first run C4 goes from 1 to 2, and D4 goes from 10 to 11. After the second run, C4 goes from 2 to 3, and D4 goes from 11 to 12, etc. This way the four list of random numbers will be updates before the next run.
Thereafter the Sub Run_Model() macro should be run to calculate results. Finally (and this is the tricky bit), the results which can be found in the range B2:B5 of sheet OUTPUT should be copy/pasted to C2:C5 on the first run, but to D2:D5 on the second, and E2:E5 on the third, etc. So each time the model is repeated, the paste are moves to the right with one column.
Can anyone add this second macro to the file?
Please note: the attached file is not my actual model, but in terms of how the sheet relate to one another it is identical.
Bookmarks