|
- Sub ykcbf() '//2025.3.26
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set Sh = ThisWorkbook.Sheets("Sheet1")
- For Each sht In Sheets
- If sht.Name <> Sh.Name Then
- With sht
- r = .Cells(Rows.Count, 9).End(3).Row
- arr = sht.UsedRange
- Sum = Application.Sum(.Cells(2, 9).Resize(r - 1))
- s = arr(2, 1) & "|" & arr(2, 4)
- d(s) = Sum
- End With
- End If
- Next
- With Sh
- arr = .UsedRange
- For i = 2 To UBound(arr)
- s = arr(i, 1) & "|" & arr(i, 4)
- If d.exists(s) Then
- arr(i, 7) = d(s)
- Else
- arr(i, 7) = ""
- End If
- Next
- .UsedRange = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|