Q:

End a while loop in a condition vba

I have a while loop that I cant seem to end when I want it to end.
In this code:
row = 3

While Cells(row, COL_B) <> ""

    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

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.
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?
Thanks in advance
/Jim

A:

Can you not use a Do While...
For example, this will exit the loop early...
Sub Test()

Dim i As Integer
Do While i < 100
    i = i + 1
    If i = 10 Then Exit Do
Loop

End Sub

