|
'这样??
Sub Comm()
Dim D As Object, i As Long, N As Long
Dim K, M, P, MM
With Worksheets("sheet1")
Set D = CreateObject("scripting.dictionary")
N = .[A65536].End(3).Row
For i = 2 To N
MM = Worksheets("sheet1").Cells(i, 1).Value
D(MM) = D(MM) + 1
Next
K = D.keys
M = D.items
P = D.Count
Worksheets("sheet2").Columns(2).Clear
Worksheets("sheet2").Columns(3).Clear
Worksheets("sheet2").[B2].Resize(P, 1) = Application.Transpose(K)
Worksheets("sheet2").[C2].Resize(P, 1) = Application.Transpose(M)
End With
End Sub
|
|