|
代码以附件为准。- Sub ykcbf() '//2024.1.29
- Dim arr, brr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("SAP-nzscrap ")
- r = .Cells(.Rows.Count, "f").End(xlUp).Row
- arr = .Range("f1:o" & r)
- End With
- ReDim brr(1 To UBound(arr), 1 To 12)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then
- d(s) = Array(arr(i, 9), arr(i, 10))
- Else
- t = d(s)
- t(0) = t(0) + arr(i, 9)
- t(1) = t(1) + arr(i, 10)
- d(s) = t
- End If
- Next
- With Sheets("时间录入与SAP对比")
- r = .Cells(.Rows.Count, 3).End(xlUp).Row
- brr = .Range("c1:j" & r)
- For i = 2 To UBound(brr)
- s = CStr(brr(i, 1))
- If d.exists(s) Then
- brr(i, 7) = d(s)(0)
- brr(i, 8) = d(s)(1)
- End If
- Next
- .Range("c1:j" & r) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|