如题!
for a=0 to 100
...
if ...then
a=a+1
end if
next
以此跳过。
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 100
If i = 19 Then
GoTo nextLoop
End If
Debug.Print i
nextLoop:
Next
End Sub
少了一句,应该是下面的
for i=1 to num
gonext:
...
if .. then
i=i+1
goto gonext
endif
....
next
建议用if不用goto 实现。
if .. then
..........
else
..........
end if
完全可以实现你说的
不要用Goto,用Exit for
for {}
for
if {}
exit for
next
exit for ---->看你的需要而定!
next
如果条件满足跳出最里层的for循环,到外面for循环继续当然你可以加exit for