Continuall Add ing values in a cell

C

CAD Concepts

Hi Everyone-

I suspect that this question has been asked before but it is difficult to
know how to find the correct thread. That being said, here it goes. I would
like to make a cell continually add values entered into them. For example,
I have a cell that has a value of $12.37 and I have to add to it a new value
as I encounter it, lets say $8.73. As it stands know, I pull out my trusty
calculator andsum up the two values and key in the sum into the field. I
have a pile of recites that I need to add as they come up. Any help is
greatly appreciated.

Manuel A. Ayala
CAD Concepts, LLC
 
B

Bob Phillips

Private Sub Worksheet_Change(ByVal target As Range)
Static nAmount

On Error GoTo ws_exit:
Application.EnableEvents = False
If target.Address(False, False) = "H10" Then
target.Value = target.Value + nAmount
nAmount = 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)
 
C

CAD Concepts

Hi Bob-

I pasted the code as you suggested but I must be missing something because
it doesn't seem to work. Do I have set some format in the cell to make it
work? Also, when inputting do I just click on the cell and enter the value I
want added to the existing.? Please advise. Thanks.

Manuel
 
B

Bob Phillips

Yes, all you do is enter values. Note the point at the end about where you
put the code. Be aware that this starts afresh for each excel seesion..

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Top