|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 yjm0809 于 2018-7-28 14:51 编辑
各位大侠,编制了个将明细审定表中数据按会计科目审定表A列及相同表头为依据进行汇总填列的程序,不会计算明细审定表中数据的累加及给会计科目审定表赋值了,请高手帮助修改下吧,谢谢!!!!
Sub test()
Dim d As Object
Dim r%, i%
Dim arr
Set d = CreateObject("scripting.dictionary")
With Worksheets("?????????")
r = .Cells(.Rows.Count, 1).End(xlUp).Row
arr = .Range("a8:a" & r)
End With
For i = 1 To UBound(arr)
d(arr(i, 1)) = 0
Next
With Worksheets("??????????")
r1 = .Cells(.Rows.Count, 1).End(xlUp).Row
For j = 1 To r1
arr = .Range(.Cells(j + 7, 1), .Cells(r, 25))
For i = 1 To UBound(arr)
If d.Exists(arr(i, 1)) Then
d(arr(i, 1)) = d(arr(i, 1)) + arr(i, 2)
End If
Next
Next
End With
With Worksheets("?????????")
For i = 1 To UBound(arr)
.Cells(i + 7, 4) = d(arr(i, 4))
Next
End With
End Sub
|
|