This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.
Using conditional statements and looping statements (also called control structures), you can write Visual Basic code that makes decisions and repeats actions. Another useful control structure, the With statement, lets you to run a series of statements without having to requalify an object.
Conditional statements evaluate whether a condition is True or False, and then specify one or more statements to run, depending on the result. Usually, a condition is an expression that uses a comparison operator to compare one value or variable with another.
Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is False; others repeat statements until a condition is True. There are also loops that repeat statements a specific number of times or for each object in a collection.
In Visual Basic, usually you must specify an object before you can run one of its methods or change one of its properties. You can use the With statement to specify an object once for an entire series of statements.
With: Running a series of statements on the same object
Was this page helpful?
Your feedback about this content is important. Let us know what you think.