代码在第160行停止。我需要它在整个列表中运行,直到最后一个填充的单元格
Dim mrow As Long, Arow As Long, iRows As Long, srow As String
Dim x As Long, y As Long, i As Long
Dim AG_Label As String, AG_val As String, SNL_val As String, SNL_Label As String, M_Label As String, Rng As Range
Dim Vval As Long, Speriod As String, aperiod As String
Dim M_Match_1
Arow = Sheets("AG").Range("A" & Rows.count).End(xlUp).Row
For i = 2 To Arow
AG_Label = Sheets("AG").Cells(j, "N").Value
mrow = Sheets("Mappings").Range("A" & Rows.count).End(xlUp).Row
For j = 2 To mrow
M_Match_1 = Sheets("Mappings").Cells(j, "P").Value
M_Label = Sheets("Mappings").Cells(j, "C").Value
If AG_Label = M_Label And Sheets("Mappings").Cells(j, "L").Value = "FRY-9C" Then
Sheets("Mappings").Cells(j, "J").copy
Sheets("AG").Cells(Rows.count, "AM").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
On Error Resume Next
End If
Next j
Next i
Application.CutCopyMode = False
End Sub