Chapter 9: Implementing Program Flow
So far, we've mostly worked with either recorded macros, or relatively simple and short procedures. The code was easy to follow, since it started on line one and flowed line by line, until the procedure ended. Your life is about to change, however, because program flow will introduce you to conditions and decisions. It will be up to you to anticipate what users will do or expect, and write code to meet those expectations.
In this chapter, we will cover the following recipes:
- Exploring program flow
- Changing the flow using the
GoTostatement - Using
IfandIf-Thenstructures to make decisions - Using the
Select Casestructure - Using loops
By the end of this chapter, you will be able to implement program flow principles in your VBA Sub procedures.