ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   multiple subtraction from one field (https://www.excelbanter.com/excel-worksheet-functions/174850-multiple-subtraction-one-field.html)

dtwood456

multiple subtraction from one field
 
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.

Gary''s Student

multiple subtraction from one field
 
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.
--
Gary''s Student - gsnu200766


"dtwood456" wrote:

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.



All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com