Sub Demo2()
Const A = 7, D = 4
Dim Rg As Range, P&, V, W, N&
With Application
.ScreenUpdating = False
.StatusBar = " Initialization …"
With [A1].CurrentRegion.Rows
.Sort .Cells(A), 1, .Cells(D), , 1, Header:=1
Set Rg = .Columns(A).Find(0, , , 1)
If Rg Is Nothing Then
V = Application.Lookup(-0.00001, .Columns(A))
If IsNumeric(V) Then P = .Columns(A).Find(V, , , 1, , 2).Row
Else
P = Rg(0).Row
.Range(Rg, .Columns(A).Find(0, , , 1, , 2)).ClearContents
Set Rg = Nothing
.Sort .Cells(A), Header:=1
End If
If P > 2 And P < .Count Then
.Item("2:" & P).Sort .Cells(A), 1, .Cells(D), , 2, Header:=2
With .Range(.Cells(2, A), .Cells(A).End(xlDown))
V = .Value2
W = Evaluate("IF({1},INT(" & .Columns(D - A + 1).Address & "))")
Application.StatusBar = " Checking in progress …"
For N = P - 1 To 1 Step -1
While V(P, 1) < -V(N, 1) And P < UBound(V): P = P + 1: Wend
If V(P, 1) = -V(N, 1) Then
Do While W(P, 1) < W(N, 1) And P < UBound(V)
P = P + 1: If V(P, 1) > -V(N, 1) Then Exit Do
Loop
If V(P, 1) = -V(N, 1) Then If W(P, 1) = W(N, 1) Then V(N, 1) = Empty: V(P, 1) = Empty
End If
If P = UBound(V) Then If V(P, 1) < -V(N, 1) Then Exit For
Next
.Value2 = V
End With
End If
If .Cells(A).End(xlDown).Row < .Count Then
.Sort .Cells(A), Header:=1
.Item(Cells(Rows.Count, A).End(xlUp)(2).Row & ":" & .Count).Clear
End If
.Sort .Cells(D), Header:=1
End With
.ScreenUpdating = True
.StatusBar = False
End With
End Sub