我有一段代码,我希望 for 循环继续到 i
的下一个值如果单元格中的值为"nil"
并且不执行循环中的命令。我无法弄清楚。
For i = 2 To n
If .Cells(i, "G").Value = "nil" Then
next i
Else
mon = month(.Cells(i, "G").Value)
acctyp = .Cells(i, "P").Value
end if
next i
提前致谢。
最佳答案
comparison operator <>
表示“不等于”:
For i = 2 To n
If .Cells(i, "G") <> "nil" Then
mon = Month(.Cells(i, "G"))
acctyp = .Cells(i, "P")
End If
Next i
关于vba - 在 for 循环中跳过迭代(VBA excel),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52474677/