multiple subtraction from one field

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.
 
G

Gary''s Student

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top