Chapter 6Repeating Actions in VBA

Now that you’ve learned how conditional statements can give your VBA procedures decision-making capabilities, 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 learn how to loop through your code.

Visual Basic has two types of Do loop statements ...

Get Access 2007 Programming by Example with VBA, XML, and ASP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.