|
- Sub qs()
- Dim arr, i, dic As Object
- On Error Resume Next
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet2.UsedRange.Value
- For i = 2 To UBound(arr)
- s = arr(i, 7): s2 = CDate(arr(i, 5))
- If Not dic.exists(s) Then Set dic(s) = CreateObject("scripting.dictionary")
- If Not dic(s).exists(s2) Then
- dic(s)(s2) = arr(i, 13)
- Else
- dic(s)(s2) = dic(s)(s2) + arr(i, 13)
- End If
- Next
- brr = Sheet1.UsedRange.Value
- For i = 4 To UBound(brr)
- If brr(i, 3) <> Empty Then
- s = brr(i, 3)
- For j = 23 To 53
- s2 = CDate(brr(3, j))
- If dic(s).exists(s2) Then
- brr(i, j) = dic(s)(s2)
- End If
-
- Next
-
- End If
- Next
- Sheet1.Range("a1").Resize(UBound(brr), UBound(brr, 2)) = brr
- Set dic = Nothing
- End Sub
复制代码 |
|