|
楼主 |
发表于 2013-5-26 13:28
|
显示全部楼层
Sub 统计()
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
Set d3 = CreateObject("scripting.dictionary")
Dim rng As Range
For Each rng In Range("d3:d375")
d1(rng.Value) = d1(rng.Value) + 1
d2(rng.Offset(, 1).Value) = d2(rng.Offset(, 1).Value) + 1
d3(Trim(Left(rng.Offset(, 3), InStr(rng.Offset(, 3), " ")))) = d3(Trim(Left(rng.Offset(, 3), InStr(rng.Offset(, 3), " ")))) + 1
Next rng
For Each rngd In d1.keys
m = m + 1
Cells(m + 1, "i") = rngd
Next rngd
m = 0
For Each rngd In d1.items
m = m + 1
Cells(m + 1, "j") = rngd
Next rngd
m = 0
For Each rngd In d2.keys
m = m + 1
Cells(m + 1, "k") = rngd
Next rngd
m = 0
For Each rngd In d2.items
m = m + 1
Cells(m + 1, "l") = rngd
Next rngd
m = 0
For Each rngd In d3.keys
m = m + 1
Cells(m + 1, "m") = rngd
Next rngd
m = 0
For Each rngd In d3.items
m = m + 1
Cells(m + 1, "n") = rngd
Next rngd
End Sub
|
|