View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Els Els is offline
external usenet poster
 
Posts: 3
Default Exit two loops at once

You could type under the loops a label (LabelName:)
and in your loop: GoTo LabelName


"Jan Kronsell" schreef in bericht
...

Is it possibble to exit two for loops at once?

I have some code like this

Sub INCC()
Set rng = ActiveSheet.UsedRange.Cells
For c = 1 To rng.Columns.Count
For r = 1 To rng.Rows.Count
If something Then
Some code here....
Exit For
End If
Next r
If something Then Exit For
Next c
more code here.....
End Sub

Now I was wandering if its possible to exit both loops if the condtion in
the inner loop is met, without having to test again in to leave the outer
loop.

Jan