ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   End loop macro with count (https://www.excelbanter.com/excel-programming/271788-end-loop-macro-count.html)

Jason C.

End loop macro with count
 
Help! I want to limit the number of times my loop macro iterates to,
for example, 20 times. I have attempted to use a "count" function but
I don't have a working example, I can't locate one, and my attempt
doesn't work.

Can someone please provide a simple way of doing this.

The routine has apprximately 15 sub routines. A count limit that
applies to a specific sub routine will be perfect or one that applies
to the whole routine will be near enough to.

Thanks in advance.

Chip Pearson

End loop macro with count
 
Jason,

Try using a For loop. E.g.,

Dim N As Long
For N = 1 To 20
' your code here
Next N


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


"Jason C." wrote in message
om...
Help! I want to limit the number of times my loop macro iterates

to,
for example, 20 times. I have attempted to use a "count"

function but
I don't have a working example, I can't locate one, and my

attempt
doesn't work.

Can someone please provide a simple way of doing this.

The routine has apprximately 15 sub routines. A count limit that
applies to a specific sub routine will be perfect or one that

applies
to the whole routine will be near enough to.

Thanks in advance.





All times are GMT +1. The time now is 03:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com