Chapter 11. Making Decisions in Your Code

Computers behave intelligently in large part because programming languages include commands that test conditions, then branch to appropriate sections of code based on the results of that test. It's similar to human decision making: if it's raining, then take an umbrella.

This chapter shows you the conditional expressions that VBA provides for creating decision structures to direct the flow—the path of execution—of your procedures.

By using decision structures, you can cause your procedures to branch to different sections of code depending on such things as the value of a variable or expression or whether the user clicks the OK or Cancel button in a message box.

VBA offers two types of decision structures: ...

Get Mastering VBA for Microsoft® Office 2010 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.