|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim a As Range
- ar = [A1].End(4).Row
- arr = Range("C2:E" & ar)
- Set d = CreateObject("Scripting.Dictionary")
- For Each a In Range("C2:E" & ar)
- If a.Interior.ColorIndex = 6 Then
- d(arr(a.Row - 1, 3)) = d(arr(a.Row - 1, 3)) + a.Value
- End If
- Next
- k = d.keys
- t = d.items
- [K4].Resize(d.Count, 1) = Application.Transpose(k)
- [L4].Resize(d.Count, 1) = Application.Transpose(t)
- [L4].Resize(d.Count, 1).NumberFormat = "#,000.00"
- Set d = Nothing
- End Sub
复制代码 |
|