В вашей строке if обменяйте Col на xCol!Используйте «Option Explicit», чтобы избежать подобных ошибок!
For x2 = x2Row To 2 Step -1
For xl = xRow To 2 Step -1
If ((Cells(xl, Col) = ...
После исправления этой ошибки ваш код выполняет следующие сравнения (что, я считаю, не то, что вы хотите сделать):
x2 xl Compare 1 Compare2
5 5 B5=B4 A5=A4
5 4 B4=B3 A5=A4
5 3 B3=B2 A5=A4
5 2 B2=B1 A5=A4
4 5 B5=B4 A4=A3 => DELETE
4 4 B4=B3 A4=A3
4 3 B3=B2 A4=A3 => DELETE
4 2 B2=B1 A4=A3
3 5 B5=B4 A3=A2
3 4 B4=B3 A3=A2
3 3 B3=B2 A3=A2
3 2 B2=B1 A3=A2
2 5 B5=B4 A2=A1
2 4 B4=B3 A2=A1
2 3 B3=B2 A2=A1
2 2 B2=B1 A2=A1
Чтобы напечатать сравниваемые адреса, я добавил следующие строки:
If ((Cells(xl, xCol) = Cells(xl - 1, xCol)) And (Cells(x2, x2Col) = Cells(x2 - 1, x2Col))) Then
Debug.Print x2; xl; Cells(xl, xCol).Address; "="; Cells(xl - 1, xCol).Address, Cells(x2, x2Col).Address; "="; Cells(x2 - 1, x2Col).Address; "=> DELETE"
Cells(xl, xCol) = ""
Else
Debug.Print x2; xl; Cells(xl, xCol).Address; "="; Cells(xl - 1, xCol).Address, Cells(x2, x2Col).Address; "="; Cells(x2 - 1, x2Col).Address
End If