|
Private Sub CommandButton1_Click()
Set d = CreateObject("scripting.dictionary")
With Sheets("生产计划")
col = .Cells(2, Columns.Count).End(1).Column
r = .Cells(.Rows.Count, 3).End(3).Row
For i = 3 To r
For j = 15 To col
s = .Cells(i, 7) & "-" & .Cells(i, 3) & "-" & .Cells(2, j)
d(s) = .Cells(i, j)
Next
Next
End With
With Sheets("标准用量")
col = .Cells(2, Columns.Count).End(1).Column
r = .Cells(.Rows.Count, 3).End(3).Row
For i = 3 To r
For j = 8 To col
s = .Cells(i, 2) & "-" & .Cells(i, 3) & "-" & .Cells(2, j)
If d.exists(s) Then
.Cells(i, j) = .Cells(i, 6) * d(s)
Else
.Cells(i, j) = 0
End If
Next
Next
End With
End Sub
|
|