第1个回答 2012-03-20
Set D = CreateObject("Scripting.Dictionary")
n = Cells(65536, 1).End(3).Row
Set rng = Cells(n + 1, 1)
For i = n To 1 Step -1
If Application.CountIf(Range("A:A"), Cells(i, 1)) > 1 Then
Set rng = Union(rng, Cells(i, 1))
D(Cells(i, 1).Value) = D(Cells(i, 1).Value) + Cells(i, 2)
Cells(i, 1) = "aaaaa"
Else
Cells(i, 2) = D(Cells(i, 1).Value) + Cells(i, 2)
End If
Next
rng.EntireRow.Delete
Application.ScreenUpdating = True
End Sub
第2个回答 2012-03-20
在B1输入公式=IF(COUNTIF(A$1:A1,A1)>1,"重复",""),下拉。