see attached file...
Sub ReconcileAccounts_Find_Method()
'https://msdn.microsoft.com/en-us/library/office/ff839746.aspx
Dim calc As Long, LastRow As Long, LastCol As Long, i As Long, ColRef As Long, ColAmount As Long
Dim CellRef As Range, CellAmount As Range, RangeSort As Range
With Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
calc = .Calculation
.Calculation = xlCalculationManual
End With
With Worksheets("Database")
If .AutoFilterMode Then .AutoFilterMode = False
On Error Resume Next
Set CellRef = .Rows(1).Find("Recon. Ref")
On Error GoTo 0
If Not CellRef Is Nothing Then
ColRef = CellRef.Column
Else
MsgBox "Header 'Recon. Ref' not found in Row 1 of table. Exiting..."
Exit Sub
End If
On Error Resume Next
Set CellAmount = .Rows(1).Find("Amount")
On Error GoTo 0
If Not CellAmount Is Nothing Then
ColAmount = CellAmount.Column
Else
MsgBox "Header 'Amount' not found in Row 1 of table. Exiting..."
Exit Sub
End If
LastRow = .Cells(.Rows.Count, ColRef).End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set RangeSort = .Range(.Cells(1, 1), .Cells(LastRow, LastCol))
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=.Range(.Cells(2, ColRef), .Cells(LastRow, ColRef)), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With .Sort
.SetRange RangeSort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For i = LastRow To 3 Step -1 '3 so that the last iteration of i - 1 equals to 2
If .Cells(i - 1, ColRef) = .Cells(i, ColRef) And .Cells(i - 1, ColAmount) + .Cells(i, ColAmount) = 0 Then
Rows(i - 1 & ":" & i).EntireRow.Delete
End If
Next i
End With
With Application
.EnableEvents = True
.Calculation = calc
End With
End Sub