|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("测试")
- r = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- arr = .Range("a1:k" & r)
- For i = UBound(arr) To 1 Step -1
- If arr(i, 2) = "小计" Then
- xj = arr(i, 5)
- End If
- If Len(arr(i, 3)) <> 0 Then
- If Not d.exists(arr(i, 3)) Then
- d(arr(i, 3)) = xj
- End If
- End If
- Next
- .Cells(UBound(arr), 5) = Application.Sum(d.items)
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|