Repeating Actions in VBA

Do Loops: Do...While and Do...Until ■ Watching a Procedure Execute ■ While...Wend Loop ■ For...Next Loop ■ For Each...Next Loop ■ Exiting Loops Early ■ Nested Loops ■ What's Next.

Now that you've learned how conditional statements can give your VBA procedures decision-making capability, it's time to get more involved. Not all decisions are easy. Sometimes you will need to perform a number of statements several times to arrive at a certain condition. On other occasions, however, after you've reached the decision, you may need to run the specified statements as long as a condition is true or until a condition becomes true. In programming, performing repetitive tasks is called looping. VBA has various looping structures that allow you to repeat a sequence of statements a number of times. In this chapter, you will learn how to loop through your code.

0 0

Post a comment