multiple subtraction from one field

  • Thread starter Thread starter dtwood456
  • Start date Start date
D

dtwood456

How do I set up a quantity field so that I can put a starting quantity, then
subtract a number from it, then later, come back to that same subtract field
and subtract again to get a constant quantity that is dropping to reflect the
multiple entries . Example, Qty of 100 in cell a1. In cell b1 I put 10 to
remove a1 from stock. Later I come back to b1 and type in 5. I want my
total in a1 to now be 85. Any help would be appreciated.
 
Put the following Event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r1 = Range("A1")
Set r2 = Range("B1")
If Intersect(Target, r2) Is Nothing Then Exit Sub
r1.Value = r1.Value - r2.Value
End Sub

REMEMBER: the worksheet code area, not a standard module.
 
Back
Top