我想下面的代碼做評估數據集中的每一行,匹配列35的範圍,然後在正確的標籤粘貼。退出嵌套的「如果」語句
我在與If Not IsError
聲明麻煩。在這場比賽中不會發生的實例,我想If Not Then
跳過剩餘的嵌套代碼,並跳轉到For
循環的結束,移動到下一行iRow
。
Sub testFind()
Dim csCount As Range
Dim b As Variant
Dim shrow As Long
Dim iRow As Long, iRowL As Long, var As Variant
Dim bln As Boolean
Dim s As String
Dim eRow As Integer
Set csCount = Worksheets("Input").Range("csCount")
iRowL = Cells(rows.count, 1).End(xlUp).Row
For iRow = 2 To iRowL
If Not IsEmpty(Cells(iRow, 35)) Then
bln = False
var = Application.Match(Cells(iRow, 35).Value, Worksheets("Input").Columns(3), 0)
If Not IsError(var) Then
Sheets("GL008").rows(iRow).copy
s = Sheets("GL008").Cells(iRow, 35)
Sheets(s).Activate
eRow = Sheets(s).Cells(rows.count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Sheets(s).rows(eRow)
End If
End If
Next iRow
End Sub
我並不想退出對,我想退出。如果繼續到For的下一個iRow。 – KM617
http://stackoverflow.com/questions/5895908/continue-for-loop – CinCout