|
本帖最后由 icenotcool 于 2024-9-27 16:54 编辑
各位老师好,我有个工作簿是有系统导出数据,我模拟了“汇总”表,位置是固定的,根据"系统导出"sheet表A列"材料编码"来提取到“汇总”表对应的汇总,原有模块出错参数设置请帮忙修改,谢谢,已经上传附件,需要修改代码如下:
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
|
|