|
- Private Sub CommandButton1_Click()
- Dim i&, j&, k&, arr, brr, crr()
- arr = Sheets("BOM表").[a1].CurrentRegion
- brr = Sheets("产品入库表").[a1].CurrentRegion
- ReDim crr(1 To UBound(arr), 1 To 5)
-
- For j = 2 To UBound(brr)
- For i = 2 To UBound(arr)
- If arr(i, 1) = brr(j, 1) Then
- k = k + 1
- crr(k, 1) = arr(i, 1)
- crr(k, 2) = arr(i, 2)
- crr(k, 3) = arr(i, 3)
- crr(k, 4) = arr(i, 4)
- crr(k, 5) = arr(i, 5) * brr(j, 3)
- End If
- Next
- Next
-
- Sheets("生产领料表").[a1].CurrentRegion.Offset(1).ClearContents
- Sheets("生产领料表").[a2].Resize(k, 5) = crr
- Sheets("生产领料表").Select
- End Sub
复制代码 |
|