|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 自动统计()
Set d = CreateObject("Scripting.Dictionary")
Set d1 = CreateObject("Scripting.Dictionary")
arr = Sheet1.[a1].CurrentRegion
For i = 3 To UBound(arr)
If arr(i, 6) = "A" Then
d(arr(i, 5)) = d(arr(i, 5)) + 1
ElseIf arr(i, 6) = "C" Then
d1(arr(i, 5)) = d1(arr(i, 5)) + 1
End If
Next
[h3].Resize(d.Count) = Application.Transpose(d.keys)
[i3].Resize(d.Count) = Application.Transpose(d.items)
[j3].Resize(d1.Count) = Application.Transpose(d1.keys)
[k3].Resize(d1.Count) = Application.Transpose(d1.items)
End Sub
|
|