|
- Sub 计个数()
- Dim r&, i&, s1 As Double, s2 As Double
- Dim Arr, Brr, Crr, Drr, ge, dic
- Set dic = CreateObject("scripting.dictionary")
- With Worksheets("Sheet2")
- r = .Cells(.Rows.count, 1).End(xlUp).Row
- Arr = .Range("A1:A" & r)
- For i = 2 To UBound(Arr)
- If Not dic.exists(Arr(i, 1)) Then
- dic(Arr(i, 1)) = 1
- Else
- dic(Arr(i, 1)) = dic(Arr(i, 1)) + 1
- End If
- Next
- For i = 2 To UBound(Arr)
- Arr(i, 1) = dic(Arr(i, 1))
- Next
- .Range("B2:B" & r).ClearContents
- .Range("B1").Resize(r, 1) = Arr
- End With
- Set dic = Nothing
- End Sub
复制代码 |
|