I've used excel to build a simulator. I plan to analyze the results of this simulation using an outside program that requires data to be formatted as .csv files. I want to use VBA code to automatically generate these files, so that I don't have to manually process hundreds of files.
My simulation makes use of the rand() function, so the possible output values change (as they should) every time you run the simulation. I'd like to be able to tweak a parameter in VBA to set the number of iterations. Put differently, I want to tell excel "run the simulation 200 times." I then want VBA to write the output cells (M3:R13) to 200 different .csv files, each with a unique file name. Ideally, the VBA code should write the .csv files to the same folder where I have saved the simulator.
If it matters, cell M3 is blank; cells N3:R3 contain column names, and cells M4:M13 contain row names. Cells N4:R13 contain numeric values. The program that I'm using for subsequent analysis requires both row and column headers, so it's important that the .csv files contain everything that appears in M3:R13.
If the problem that I've outlined isn't clear, please ping me with questions. I'll be more than happy to answer them. And I hope that it goes without saying, but I'll greatly appreciate any help that the forum members can offer. Thanks for your time and attention.
Bookmarks