title: VBA Compile Error 'Wend Without While'
body: <p>I have a VBA macro in excel that has run fine for a while. I've been making changes with these loops already working and suddenly the code is not compiling:</p>
  
  <blockquote>
    <p>Compile error: Wend without While</p>
  </blockquote>
  
  <p>I have tried changing to Do While...Loop loops, but I got the equivalent</p>
  
  <blockquote>
    <p>Compile error: Loop without Do</p>
  </blockquote>
  
  <p>Here is the structure of my code:</p>
  
  <pre><code>'This loop is fine
  While '(code for evaluation)
  'code to run in loop
  Wend
  
  While '(more eval code)
  'code
    While '(eval code)
    'code
    Wend '&lt;--This is where the compile error occurs
    'code
    While '(eval code)
    'code
    Wend
  'code
  Wend
  </code></pre>
  
  <p>Does anyone have any idea what could be the issue? (Bonus: Does the indentation of code actually matter?)</p>