|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 182197315 于 2016-7-26 22:06 编辑
Sub 汇总()
Sheets(1).Range("A2:B65535").ClearContents
Dim i%, j%, k%, x%, arr(), brr(1 To 65535, 1 To 2)
Dim d As Object
Set d = CreateObject("scripting.dictionary")
arr = Sheets(2).Range("A1").CurrentRegion.Value
For i = 2 To UBound(arr)
For j = 2 To UBound(arr, 2)
If arr(i, j) <> "" Then
If Not d.exists(arr(i, j)) Then
k = k + 1
d(arr(i, j)) = k
brr(k, 1) = arr(i, j)
brr(k, 2) = 1
Else
x = d(arr(i, j))
brr(x, 2) = brr(x, 2) + 1
End If
End If
Next
Next
Sheets(1).Range("A2").Resize(k, 2) = brr
End Sub
|
评分
-
2
查看全部评分
-
|