简体   繁体   English

Excel VBA跳过执行while循环

[英]Excel VBA Skip Do while loop

How to use continue statement to skip the loop for next iteration. 如何使用continue语句跳过循环以进行下一次迭代。 So that if condition fails the loop must go for next iteration 因此,如果条件失败,则循环必须进行下一次迭代

The code goes as follows: 代码如下:

Do While i<50 
    If IsEmpty(Cells(EndRow, 25)) = False Then
        Continue Do 
    Else 
        Cells(EndRow, 25).Interior.ColorIndex = 37 
    i = i+1 
LOOP

maybe you're after this 也许你在追求这个

Do While i < 50
    If IsEmpty(Cells(EndRow, 25)) Then Cells(EndRow, 25).Interior.ColorIndex = 37
    i = i + 1
Loop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM