O'Reilly logo

Mastering VBA for Microsoft Office 2016 by Richard Mansfield

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11Making Decisions in Your Code

Computers behave intelligently in large part because programming languages offer a way to test conditions. Then based on the results of that test, the code jumps (branches) to an appropriate area within the program. This is similar to human decision-making: If it's raining, then take an umbrella. If not, leave it at home.

This chapter covers what are called conditional expressions. VBA uses them to create 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required