Whats Next

Conditional statements, which were introduced in this chapter, let you control the flow of your procedure. By testing the truth of a condition, you can decide which statements should be run and which ones should be skipped over. In other words, instead of running your procedure from top to bottom, line by line, you can execute only certain lines. If you are wondering what kind of conditional statement you should use, here are a few guidelines:

■ If you want to supply only one condition, the simple If.. .Then statement is the best choice.

■ If you need to decide which of two actions to perform, use the If.. .Then.. .Else statement.

■ If your procedure requires two or more conditions, use the If.. .Then.. .ElseIf or Select Case statements.

■ If your procedure has many conditions, use the Select Case statement. This statement is more flexible and easier to comprehend than the

Some decisions have to be repeated. For example, you may want to repeat the same actions for each cell in a worksheet or each sheet in a workbook. The next chapter teaches you how to perform the same steps over and over again.

0 0

Post a comment