|
本帖最后由 icenotcool 于 2024-9-27 21:50 编辑
各位老师,可以看看我的求助贴吗?跨表提取不重复数据并按条件汇总(去重求和)-Excel VBA程序开发-ExcelHome技术论坛 - https://club.excelhome.net/forum ... amp;_dsign=91595a5e
Sub Total()
Set d = CreateObject("scripting.dictionary")
Application.ScreenUpdating = False
arr = Sheets("系统导出").UsedRange
r = 0
For j = 1 To UBound(arr)
If arr(j, 9) = "金额" Then
If d.exists(arr(j, 9) & "") Then
X = d(arr(j, 9) & "")
arr(X, 6) = arr(X, 6) + arr(j, 6)
Else
r = r + 1
d(arr(j, 9) & "") = r
arr(r, 1) = arr(j, 1)
arr(r, 2) = arr(j, 2)
arr(r, 3) = arr(j, 3)
arr(r, 4) = arr(j, 8)
arr(r, 5) = arr(j, 7)
arr(r, 6) = arr(j, 9)
End If
End If
Next j
If r > 0 Then [A1].Resize(r, 6) = arr
Application.ScreenUpdating = True
End Sub |
|