Do...Loop Macro

  • Thread starter Thread starter Cass
  • Start date Start date
C

Cass

I have a macro that I want to automatically repeat. How
and where to I plug in the Do Loop.

Ex. I have text that I want to Cut and Paste on a line,
that procedure needs to run about 10 times. How to I tell
my macro to keep repeating itself?
 
Cass,

You would write the code something like

Do Until (some_condition = False)
' your existing code here
Loop

The some_condition depends on your application. This should
return a value of TRUE as long as you want to continue looping.
When some_condition equals FALSE, the loop will terminate and
execution will continue at the first line of code following the
Loop statement.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top