|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test1() '仅参考
- Dim ar, Dict As Object, i As Long, y As Long
- Set Dict = CreateObject("Scripting.Dictionary")
- ar = Range("K2", Cells(Rows.Count, "k").End(xlUp))
- For i = 1 To UBound(ar)
- If Len(CStr(ar(i, 1))) Then Dict(CStr(ar(i, 1))) = i
- Next
- ReDim br(1 To i - 1, 1 To 1) As Double
- ar = Range("A1").CurrentRegion
- For i = 3 To UBound(ar)
- If Len(ar(i, 1)) Then
- y = Dict(Split(ar(i, 1), "-")(0))
- If y Then br(y, 1) = br(y, 1) + ar(i, 8)
- End If
- Next
- Range("N2").Resize(UBound(br)) = br
- Set Dict = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|