下面的代码由我编辑以获得结果,但不幸得到它。我正在尝试将 sheet1 Col A&B 与 sheet2 Col A&B 以及 sheet3 上的结果进行比较。好心提醒。
Sub ReconcileRegisters()
Dim i As Long, _
LRa As Long, _
LRb As Long, _
rowx As Long
LRa = Sheets("sheet1").Range("A1:B" & Rows.Count).End(xlUp).Row
LRb = Sheets("sheet2").Range("A1:B" & Rows.Count).End(xlUp).Row
rowx = 2
Application.ScreenUpdating = False
For i = 2 To LRa
If IsError(Application.Match(Sheets("sheet1").Range("A1:B" & i).Value, Sheets("sheet2").Range("A1:B" & LRb), 0)) Then
Sheets("sheet3").Range("A" & rowx).Value = Sheets("sheet1").Range("A1:B" & i).Value
rowx = rowx + 1
End If
Next i
For i = 2 To LRb
If IsError(Application.Match(Sheets("sheet2").Range("A1:B" & i).Value, Sheets("sheet1").Range("A1:B" & LRa), 0)) Then
Sheets("sheet3").Range("A" & rowx).Value = Range("A1:B" & i).Value
rowx = rowx + 1
End If
Next i
Application.ScreenUpdating = True
MsgBox "Matching process is complete"
结束子