By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 243 - Exit Do


This statement is used to prematurely exit a Do - Loop

Do
   x = x + 1
   debug.print x
   if x > 5 then Exit Do


Loop

In the above code snippet, x will eventually be set to 5 and the Exit Do will get out of the loop.

This statement can be used to prevent an infinite loop

   Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit