我有以下代码
For x = LBound(arr) To UBound(arr)
sname = arr(x)
If instr(sname, "Configuration item") Then
'**(here i want to go to next x in loop and not complete the code below)**
'// other code to copy past and do various stuff
Next x 所以我想我可以简单地使用Then Next x语句,但这会给出一个"no for statement could“错误。
那么,我可以在If instr(sname, "Configuration item") Then后面放什么,以使其继续到x的下一个值?
发布于 2011-05-05 18:25:03
发布于 2012-10-19 02:08:43
您可以使用GoTo
Do
'... do stuff your loop will be doing
' skip to the end of the loop if necessary:
If <condition-to-go-to-next-iteration> Then GoTo ContinueLoop
'... do other stuff if the condition is not met
ContinueLoop:
Loop发布于 2015-01-20 04:39:24
For i=1 To 10
Do
'Do everything in here and
If I_Dont_Want_Finish_This_Loop Then
Exit Do
End If
'Of course, if I do want to finish it,
'I put more stuff here, and then...
Loop While False 'quit after one loop
Next ihttps://stackoverflow.com/questions/5895908
复制相似问题