如果满足条件,如何循环退出For
迭代,然后转到下一个迭代。该工作表有几千行,循环中的这种中断将加快代码的速度。这并非仅从整个循环中退出跳过一个迭代。
For i = 1 To LastRow2
For j = 1 To LastRow3
If ark2.Cells(j, "F") = ark3.Cells(i, "J") Then
GoTo NextIteration
Else
LastRow2 = ark2.Cells(Rows.Count, 1).End(xlUp).Row
ark2.Rows(LastRow2 + 1) = ark3.Rows(i)
End If
Next j
Next i