5Looping and Flow Control
IN THIS CHAPTER
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. Luckily, 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
We'll also discuss the cool loop construct unique to object oriented languages:
• For Each...Next
For...Next
Loops
These are common loop constructs. Everything between For
and Next
is run multiple times. Each time that the code runs, a certain ...
Get VBA and Macros for Microsoft Excel 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.