|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test1()
Dim d As Object, arr, brr(), i%, s, n, j%, aa, t, b%, crr, m
aa = Timer
Set d = CreateObject("scripting.dictionary")
Worksheets(1).Select
arr = Range("A1:e" & Range("A65536").End(xlUp).Row)
For i = 1 To UBound(arr)
s = arr(i, 1) & "!" & arr(i, 2) & "!" & arr(i, 3) & "!" & arr(i, 4) & "!" & arr(i, 5)
d(s) = d(s) + 1
Next i
Worksheets(2).Select
t = d.keys
ReDim brr(1 To UBound(t) + 1, 1 To 5)
For b = 0 To UBound(t)
m = Split(t(b), "!")
n = n + 1
brr(n, 1) = m(0)
brr(n, 2) = m(1)
brr(n, 3) = m(2)
brr(n, 4) = m(3)
brr(n, 5) = m(4)
Next b
[a2].Resize(n, 5) = brr
[f2].Resize(d.Count, 1) = Application.Transpose(d.items)
[a1].Resize(1, 6) = Array("分公司", "子区域", "网管名称", "网元名称", "告警端口位置", "出现次数")
Range("A2:f" & d.Count).Sort key1:=Range("F2"), order1:=xlDescending
MsgBox "程序工运行了" & Format(Timer - aa, "0.00") & "秒"
End Sub |
|