|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("需要的人员")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a1:a" & r)
- For i = 2 To UBound(arr)
- d(arr(i, 1)) = 0
- Next
- End With
- With Worksheets("数据")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:b" & r)
- For i = 1 To UBound(arr)
- If d.exists(arr(i, 1)) Then
- d(arr(i, 1)) = d(arr(i, 1)) + arr(i, 2)
- End If
- Next
- End With
- With Worksheets("需要的数据")
- .Range("a2").Resize(d.Count, 2) = Application.Transpose(Array(d.keys, d.items))
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|