title: exit a nested loop in excel
body: <p>i have a loop in a macro i'm writing of the following structure:</p>
  
  <p>there are two worksheets in this book. raw data (hence the endpointData variable) and a G/L (General ledger) sheet (hence the endpointGL variable)</p>
  
  <p>there are three <code>for</code> loops in this function: </p>
  
  <p>(1) the first loop iterates through each record in the raw data file. <br> (2) the second loop iterates through the verified matches from <code>REGEXP</code> (a regular expression search) and <br> (3) the third loop goes through the G/L and finds a corresponding match and puts (using: <code>PUT_DATA_RANGE</code>) that data into the appropriate spot. </p>
  
  <p>Here's sort of what i'm getting at:</p>
  
  <p>psuedocode:</p>
  
  <pre><code>For i = 2 To endpointData
  
      If SOME_TEST = True Then
          Set MATCHES = REGEXP.EXECUTE()
          For Each myMatch In MATCHES
              For j = 1 To endpointGL
                  If myMatch.value = SOME_CONDITION Then
                      PUT_DATA_RANGE
                      Exit For
                  ElseIf myMatch.value &lt;&gt; SOME_CONDITION Then
                      MsgBox ("there might be a problem")
                      ' EXIT BOTH LOOPS HERE
  
                      ' write handler code
              Next
              End If
          Next
      End If
  Next i
  </code></pre>
  
  <p>now you'll notice that i have a few comments to myself. if the third loops finds no match in the G/L the code currently interrupts to notify the user. but that message box <code>MsgBox("there might be a problem")</code> is looped through along with the third loop. how do i get excel to exit BOTH loops and bring the FIRST for loop to the next availabe record in the raw data? </p>
  
  <p>by the way, i've tried exiting it with an <code>Exit For</code> but that doesn't seem to work exactly. </p>