|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("存量")
- r = .Cells(.Rows.Count, 9).End(xlUp).Row
- brr = .Range("i2:k" & r)
- For i = 1 To UBound(brr)
- d(brr(i, 1)) = i
- Next
- End With
- With Worksheets("分配")
- r = .Cells(.Rows.Count, 3).End(xlUp).Row
- arr = .Range("a2:j" & r)
- For i = 1 To UBound(arr)
- If d.exists(arr(i, 3)) Then
- m = d(arr(i, 3))
- arr(i, 5) = brr(m, 2) + brr(m, 3)
- arr(i, 7) = brr(m, 2)
- arr(i, 8) = brr(m, 3)
- End If
- Next
- .Range("a2:j" & r) = arr
- End With
- End Sub
复制代码 |
|