title: In nested Excel VBA For...Next loop, parent Next cannot find its For
body: <pre><code>For j = 0 to SpreadCount
      If TypeName(ChainsDC(j,0) = "String" 'testing for an error
          Goto EndLoop
      Else:
          For i = 0 to RscSct
              ...do amazing things here (no loops)
          Next i
  EndLoop:
  Next j '&lt;&lt;&lt;PROBLEM
  </code></pre>
  
  <p>Compiler complains Next j (line 9) is a "Next without For".</p>