将列中的单元格复制到最后一行

我想计数列中的重复单元格到最后一行,我可以计算所有的行到最后一行,但不能找出重复的部分。

如果find解决scheme,我将继续查找并回传解决scheme。

编辑:更改为以下我得到错误`types不匹配“

Sub ContactName22() Dim lRow As Long Dim count As Long Sheets(2).Select lRow = Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Row count = "= SUMPRODUCT((E2 & lRow <>"""")/COUNTIF(E2 & lRow &"""")-(COUNTIF(E2 & lRow &"""")=1))" MsgBox count End Sub 

这是一个示例macros:

 Sub CountDuplicates() Dim N As Long, cl As Collection Dim dCount As Long, V As Variant N = Cells(Rows.count, 1).End(xlUp).Row Set cl = New Collection dCount = 0 For i = 1 To N V = Cells(i, 1).Value On Error Resume Next If V <> "" Then cl.Add V, CStr(V) If Err.Number = 0 Then Else Err.Number = 0 dCount = dCount + 1 End If End If Next i MsgBox "There are " & dCount & " duplicates" End Sub