If Sheets("Inventory").Cells(Rows.Count,"A").End(xlup).Row <> Sheets("On Hand").Cells(Rows.Count,"A").End(xlup).Row Then
For k = 1 to Sheets("Inventory").Cells(Rows.Count,"A").End(xlup).Row
Sheets("On Hand").Range("A" & k & ":E" & k)=Sheets("Inventory").Range("A" & k & ":E" & k)
Next k
End If
For i=1 to Sheets("Sales").Cells(Rows.Count,"A").End(xlup).Row
For j=1 to Sheets("On Hand").Cells(Rows.Count,"A").End(xlup).Row
If Sheets("Sales").Cells(i, "A") = Sheets("On Hand").Cells(j,"A") Then
If Sheets("Sales").Cells(i, "B")<>"" then Sheets("On Hand").Cells(j,"B") = Sheets("On Hand").Cells(j,"B") - 1
If Sheets("Sales").Cells(i, "C")<>"" then Sheets("On Hand").Cells(j,"C") = Sheets("On Hand").Cells(j,"C") - 1
If Sheets("Sales").Cells(i, "D")<>"" then Sheets("On Hand").Cells(j,"D") = Sheets("On Hand").Cells(j,"D") - 1
If Sheets("Sales").Cells(i, "E")<>"" then Sheets("On Hand").Cells(j,"E") = Sheets("On Hand").Cells(j,"E") - 1
End If
Next j
Next I
如果这篇文章有帮助,请标记为向上按钮。