- Sub test()
- Dim ar, br(), m&, n&, k&, w&, q&, dic, s
- Range("j61").CurrentRegion.ClearContents
- w = 60
- Set dic = CreateObject("scripting.dictionary")
- ar = Selection
- q = Selection.Row
- For n = LBound(ar, 1) To UBound(ar, 1)
- For m = 0 To 9
- dic(m) = 0
- Next
- For k = LBound(ar, 2) To UBound(ar, 2)
- s = Right(ar(n, k), 1)
- dic(Val(Right(ar(n, k), 1))) = dic(Val(Right(ar(n, k), 1))) + 1
- Next k
- w = w + 1
- Cells(w, "j") = q & "行各数个数": q = q + 1
- Cells(w, "k").Resize(1, 10) = dic.items
- dic.RemoveAll
- Next n
- End Sub
复制代码 |