Thread: for each loops
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nacho Nachev Nacho Nachev is offline
external usenet poster
 
Posts: 26
Default 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




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

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