title: End a while loop in a condition vba
body: <p>I have a while loop that I cant seem to end when I want it to end.</p>
  
  <p>In this code:</p>
  
  <pre><code>row = 3
  
  While Cells(row, COL_B) &lt;&gt; ""
  
      If Not Cells(WBSrow, COL_B).Value = Mid(Cells(row, COL_E), 1, 8) Then
  
              valueup = Cells(row, COL_E)
  
              With Range("C1:C400")
                  Set c = .Find(valueup, LookIn:=xlValues)
                  If c Is Nothing Then
                      Msgbox "Error in Column E"
                  End If
              End With
  
  
      End If
  
  row = row + 1
  
  Wend
  </code></pre>
  
  <p>I would like to add Wend right after the Msgbox within that If statement to end the loop if the condition is met. As users will input many rows there might be multiple errors of the same kind and the msgbox will then pop up X times.</p>
  
  <p>The problem I have is that I get "Wend without While" error if I put it there. I have done this with For Each loops before, any ideas why it is not working for me here?</p>
  
  <p>Thanks in advance
  /Jim</p>