|
楼主 |
发表于 2016-8-22 11:08
|
显示全部楼层
- Private Sub CommandButton1_Click()
- Dim f$, i&, t#, d, data, arr
- Set d = CreateObject("Scripting.Dictionary")
- Set data = CreateObject("Scripting.Dictionary")
- Application.Calculation = xlManual
- For i = 7 To 8
- f = Cells(2, i).Formula
- Cells(i + 8, "g") = "'" & f
- [b1].Formula = f
- [b1].Copy [b2:e65536]
- [b1].Copy [c1:e1]
- Set d(i) = CreateObject("Scripting.Dictionary")
- For j = 1 To 1000 '检测
- [f1] = 0
- t = Timer
- Calculate
- t = Timer - t
- d(i)(t) = d(i)(t) + 1
- If Not data.exists(t) Then
- data(t) = ""
- End If
- [f1] = 100
- Next
- Next
- arr = data.keys
- n = data.Count
- ReDim brr(1 To 2, 1 To n)
- For j = 0 To n - 1 '统计频次
- For i = 7 To 8
- brr(i - 6, j + 1) = d(i)(arr(j))
- Next
- Next
- [h14].Resize(1, n) = arr
- [h15].Resize(2, n) = brr
- Set d = Nothing
- Set data = Nothing
- Application.Calculation = xlAutomatic
- End Sub
复制代码
自动检测并输出统计结果 |
|