ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   for each loops (https://www.excelbanter.com/excel-programming/312365-each-loops.html)

adncmm1980[_3_]

for each loops
 

Dear all

If you have more than one for each loop in a procedure, how can I ge
my procedure to loop back to the first loop instead of the last.

Regards

Andrew

:rolleyes: :eek: :confused: :confused

--
adncmm198
-----------------------------------------------------------------------
adncmm1980's Profile: http://www.excelforum.com/member.php...fo&userid=1496
View this thread: http://www.excelforum.com/showthread.php?threadid=26604


Nacho Nachev

for each loops
 
AFAIK, the VB language does not support it. Use a flag to determine the
exit. e.g.:

dim bExit as boolean
bExit = false
For each a in as_collection
for each b in bs_collection
If [condition to exit] Then
bExit = True
Exit For
End If
next b

If bExit = True then
Exit For
End If
Next a


HTH,
Nacho

"adncmm1980" wrote in message
...

Dear all

If you have more than one for each loop in a procedure, how can I get
my procedure to loop back to the first loop instead of the last.

Regards

Andrew

:rolleyes: :eek: :confused: :confused:


--
adncmm1980
------------------------------------------------------------------------
adncmm1980's Profile:

http://www.excelforum.com/member.php...o&userid=14965
View this thread: http://www.excelforum.com/showthread...hreadid=266040





All times are GMT +1. The time now is 11:36 PM.

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