Do Until condition
'Code to be executed
Loop
Again like a Do While loop, Excel can check the condition either before entering the loop (as above) or after Excel has run through the code once, as shown below:
Do
'Code to be executed
Loop Until condition
You can use the Exit Do statement to force Excel to exit the loop when desired (instead of waiting for the specified loop condition to be met).
We can use the previous tutorial (the spreadsheet with the list of students and grades) as an example. The previous loop we used (Do While Range("C" & i).Value <> "") can be replaced with a Do Until loop instead:
Do Until Range("C" & i).Value = ""
We can use the previous tutorial (the spreadsheet with the list of students and grades) as an example. The previous loop we used (Do While Range("C" & i).Value <> "") can be replaced with a Do Until loop instead:
Do Until Range("C" & i).Value = ""
No comments:
Post a Comment