我正在尝试查看2个不同的列,它们都具有重复项,并且只清除其中一个重复项。这是我写的,但是它在countifs行上给出了错误
Sub CleareftdupsV()
Dim myLastRow As Long
Dim i As Long
Dim myCount As Long
' Find last column in row with data
myLastRow = Cells(Rows.Count, "B").End(xlUp).Row
myr = Range("E:E")
myr2 = Range("P:P")
' Loop through range backwards
For i = myLastRow To 1 Step -1
' Use Countifs function to count how many cells
myCount = Application.WorksheetFunction.CountIfs(myr, Cells(i, 5), myr2, Cells(i, 16))
' If count greater than 1, then delete cell
If myCount > 1 Then Cells(i, 16).ClearContents
Next i
End Sub
此处是数据的ex