Excel

  • Thread starter Thread starter Glenn Robertsoon
  • Start date Start date
G

Glenn Robertsoon

Hi,
Is it possible to put a formula in a cell that will add up
values put in the same cell.

e.g. I have a long list of values that need inputting
Is it possible that somebody could put a value in cell a1
and enter then another value in the same cell and then
enter another value in the same cell and then have another
cell that will add up all the values put in that cell.
 
right click sheet tab>view code>insert this. Use 0 to start over.

Option Explicit
Dim oldvalue As Double
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$5" Then
On Error GoTo fixit
Application.EnableEvents = False
If Target.Value = 0 Then oldvalue = 0
Target.Value = 1 * Target.Value + oldvalue
oldvalue = Target.Value
fixit:
Application.EnableEvents = True
End If
End Sub
 
Back
Top