5. Looping and Flow Control

Loops are a fundamental component of any programming language. If you’ve taken any programming classes, even BASIC, you’ve likely encountered a For...Next loop. Fortunately, VBA supports all the usual loops, plus a special loop that is excellent to use with VBA.

This chapter covers the basic loop constructs:

For...Next

Do...While

Do...Until

While...Loop

Until...Loop

This chapter also discusses the useful loop construct that is unique to object-oriented languages:

For Each...Next

For...Next Loops

For and Next are common loop constructs. Everything between For and Next is run multiple ...

Get VBA and Macros: Microsoft® Excel® 2010 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.