Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果这里的一些专家帮助我解决问题,那将非常有帮助:我有一个循环来检查范围内的零值,问题是我无法避免错误“for without next”。也许这是使用 End Sub 的 for 循环的错误构造?谢谢你。
For Each c In Range("B4:H4") If c.Value = 0 Then MsgBox "Wrong record!", vbExclamation End Sub Next c
退出,不是结束。
For Each c In Range("B4:H4") If c.Value = 0 Then MsgBox "Wrong record!", vbExclamation Exit Sub End If Next c
但是,通常最好制定一种方法来限制退出点的数量。