|
楼主 |
发表于 2018-6-19 14:50
|
显示全部楼层
大神,还有一个小问题 ,为了满足我整个表的使用,我对代买做了小范围的改动,运行时表格就无响应了。
代买入小
Sub summation1()
Application.EnableEvents = False
Dim d As Object, i, j, s, arr, brr, tms
tms = Timer
Set d = CreateObject("Scripting.Dictionary")
arr = Sheet13.[a1].CurrentRegion
For i = 2 To UBound(arr)
s = arr(i, 1) & arr(i, 4) & arr(i, 5) & arr(i, 7)
If Not d.exists(s) Then
d(s) = arr(i, 3)
Else
d(s) = d(s) + arr(i, 3)
End If
Next
brr = Sheet12.[a1].CurrentRegion
For i = 4 To UBound(brr)
For j = 8 To 611
If Cells(2, j).MergeCells Then brr(2, j) = Cells(2, j).MergeArea.Cells(1, 1)
If Cells(1, j).MergeCells Then brr(1, j) = Cells(1, j).MergeArea.Cells(1, 1)
s = brr(i, 1) & brr(2, j) & brr(3, j) & brr(1, j)
If d.exists(s) Then brr(i, j) = d(s)
Next
Next
[a1].CurrentRegion = brr
MsgBox Format(Timer - tms, "0.0000s")
Application.EnableEvents = True
End Sub
|
|