我尝试在Excel中使用Continue For语句,但它抛出一个编译错误:"Expected“。代码如下:
For i = 3 To num
If Cells(i, 19) = "" Then
continue for
End If
Next i这一切为什么要发生?PS:这是实际代码的简化版本。
发布于 2016-01-26 02:06:58
最简单的方法是在不满足条件时简单地进行处理。
For i = 3 To num
If Cells(i, 19) <> "" Then
'execute the rest of the processing
End If
Next i避免在For Next循环中递增i。不鼓励使用GoTo,而且在很大程度上没有必要(如上所述)。
如果值是键入的值,而不是从公式返回,则xlCellTypeConstants的Range.SpecialCells method中的每个值都将是备用的。
https://stackoverflow.com/questions/34999093
复制相似问题