The code below is meant to find an item that exists in one sheet, but not another. If this is the case, I want to cut and paste that row to another sheet, and then delete the empty row that is left behind. This is what I have currently:
Dim contract1 as Range
Dim match2 as Range
Dim j as Long
j = 2
Set contract1 = ActiveWorkbook.Sheets("UpdatedWS").Cells(j, 3)
'Cut and paste new policies into Differences worksheet and _
delete rows left empty
For Each contract1 In Sheets("UpdatedWS").Range("C2", "C43")
With Sheets("Current").Range("C:C")
Set match2 = .Find(What:=contract1, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not match2 Is Nothing Then
Else
DiffCounter = DiffCounter + 1
contract1.EntireRow.Cut _
Sheets("Differences").Cells(DiffCounter + 2, 1)
Rows(contract1).Select
Selection.Delete Shift:=xlUp
End If
End With
Next contract1
When the code runs, however, I am left with a blank row in "UpdatedWS" that never got deleted.
Where am I going wrong?
Bookmarks