|
本帖最后由 sry660 于 2015-12-28 12:27 编辑
- Sub 计算次数()
- Dim arr, i&, n&, d, x, aa, brr, t$
- arr = [e4:f31]
- Set d = CreateObject("scripting.dictionary")
- For i = 1 To UBound(arr)
- x = arr(i, 1)
- If arr(i, 2) >= 0 And arr(i, 2) < 4 Then
- d(x) = d(x) & x & ","
- End If
- Next
- aa = d.keys
- ReDim brr(1 To d.Count, 1 To 2)
- For n = 0 To UBound(aa)
- brr(n + 1, 1) = n
- t = d(Format(n, "0"))
- t = Left(t, Len(t) - 1)
- If InStr(t, ",") > 0 Then
- brr(n + 1, 2) = UBound(Split(t, ",")) + 1
- Else
- brr(n + 1, 2) = 1
- End If
- Next
- [h6:q7].ClearContents
- [h6].Resize(UBound(brr, 2), UBound(brr, 1)) = Application.Transpose(brr)
- End Sub
复制代码 |
|