Loop WHILE END WHILE in VBA
While condition (true or false, something like donuts_counter < 10 )
Code you want to execute while condition is true
Wend will ends the loop
Code you want to execute while condition is true
Wend will ends the loop
Sub donuts()
' looking for the bad donuts
i = 3 ' initialise the first row where the list will begin
donuts_quality = "good" ' initialise the donuts quality to good
good_donuts = 0 ' we set the number of good donuts to 0
While donuts_quality = "good" ' begnining of the while loop
donuts_quality = Cells(i, 3) ' looks at the second column
If donuts_quality = "good" Then good_donuts = good_donuts + 1
i = i + 1
END WHILE (Formerly WEND) 'end of the while loop
' final quality statement if we found a bad donuts then we say it.
If donuts_quality = "bad" Then
Range("E5").Value = "not all dounts were good, please improve"
Else
Range("E5").Value = "all donuts were good, excellent"
End If
End Sub