|
参与一下。。。
- Sub ykcbf() '//2024.7.30
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("入库")
- r = .Cells(Rows.Count, 3).End(3).Row
- arr = .[a1].Resize(r, 6)
- For i = 2 To UBound(arr)
- s = arr(i, 3) & .Name
- d(s) = d(s) + Val(arr(i, 6))
- Next
- End With
- With Sheets("出库")
- r = .Cells(Rows.Count, 3).End(3).Row
- arr = .[a1].Resize(r, 6)
- For i = 2 To UBound(arr)
- s = arr(i, 3) & .Name
- d(s) = d(s) + Val(arr(i, 6))
- Next
- End With
- With Sheets("目录")
- r = .Cells(Rows.Count, 1).End(3).Row
- .[f2:h10000] = ""
- arr = .[a1].Resize(r, 8)
- For i = 2 To r
- For j = 6 To 7
- s = arr(i, 1) & arr(1, j)
- If d.exists(s) Then
- arr(i, j) = d(s)
- End If
- Next
- arr(i, 8) = arr(i, 6) - arr(i, 7)
- Next
- .[a1].Resize(r, 8) = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|