1。加个过程就可以,这样的好处是你不需要在循环上写那么多的判断代码!
For a = 0 To 100
Ok
Next a
Private Sub Ok()
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then Exit Sub
End If
Next c
Next b
End Sub
2。使用行跳转
For a = 0 To 100
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then
Goto OK
End If
Next c
Next b
ok:
Next a
3.使用变量检查
For a = 0 To 100
For b = 0 To 100
If Ok then Exit For
For c = 0 To 100
If Text1.txt = "I Love You" Then
OK = True
Exit For
End If
Next c
Next b
Next a
exit for