macros在列中查找重复项

在我的工作表上,重复项可能出现在“P”列中。 我必须迭代列P,如果有任何重复发生,那么我必须检查列A和B中的一个条件。请帮助我如何通过迭代使用vba代码中的macros来查找重复的列。

这是我的代码:

Dim Rng As Range Dim cel As Range Set Rng = Range(Range("P11"), Range("P" & Rows.Count).End(xlUp)) For Each cel In Rng If WorksheetFunction.CountIf(Rng, cel.Value) > 1 Then MsgBox ("dupli") End If Next cel