Exploring program flow
This chapter will open the door for you to a whole new way of thinking about programming. In the previous chapters, we've merely scratched the surface – making sure that you know your way around some basic, and some not so basic, aspects of VBA.
Program flow controls how your code is executed. This is where the real programming starts. Instructing a machine to make decisions has always been a challenge for programmers. A PC, by definition, is an unintelligent piece of hardware. Everything it does is done via software that has been designed by humans. Every command that software executes is based on a set of choices – options between two or more actions.
It's up to you, the programmer, to think of all the possible options your code has to choose between. You need to control the flow of your code by skipping over some statements and executing others, once or several times, until certain conditions are met. Every step of the way, your...