Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$T$1" Then
Me.Range("A1").Value = Me.Range("A1").Value + Target.Value
ElseIf Target.Address = "$S$1" Then
Me.Range("A1").Value = Me.Range("A1").Value - Target.Value
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Patrick" wrote in message
...
I want to format a cell to keep a total. We will call this cell T. I want
it
to keep a total from cell A which when I put a number it will add to the
total in cell T. I also want cell T to keep a total from cell S so when I
put
a number in S then it will subtract from the total. Ok I know how to do
that.
My question is when I put a number in either cell S or A I want to be able
to
see that entry but then if I want to add another number to it the total
adds
that number also.
Here is an example T=0, I put 20 in A. Now T shows 20 and A also shows 20.
Now I want to put 20 in A again. I want for T to show 40 now and A to show
20. When I do this it does not change the total.
|