From the course: Excel VBA: Process Modeling
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Adapt the code for multiple runs - Microsoft Excel Tutorial
From the course: Excel VBA: Process Modeling
Adapt the code for multiple runs
- [Instructor] In the previous movie, we ran a simulation that calculated the time a customer would spend at each station of a sandwich shop. The code we created only allowed for a single run, and even though we ran it multiple times by ourselves, it's much easier to do that in code. So in this movie, I will show you how to add a loop to your simulation code that lets you run multiple simulations so you get more data to analyze. My sample file is chapter 0208, and you can find it in the chapter two folder of the exercise files collection. I want to make the number of runs easily visible for anyone who uses the workbook, so I'm going to put the number of runs in the Sim Setup worksheet. So in cell D2, I will type a label for the number of runs. So I'll do a hashtag for number of runs, then I'll click A2. Then on the home tab of the ribbon, click the format painter button and then click D2. Then in cell E2 I will type in the number of runs and I'll just do two, that will make sure that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Describe process flow and programming goals1m
-
(Locked)
Declare variables used in the simulation7m 12s
-
Define the Customers class and add a customer3m 46s
-
(Locked)
Define the Stations class and add stations8m 12s
-
(Locked)
Add code to calculate and write out times6m 21s
-
(Locked)
Delete unneeded objects1m 47s
-
(Locked)
Run the simulation1m 43s
-
(Locked)
Adapt the code for multiple runs5m 12s
-
(Locked)
-
-
-
-
-
-