J
jrambo63
From this group I learned to add a single cell accumulator using the
code on http://www.mcgimpsey.com/excel/accumulator.html
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Static dAccumulator As Double
With Target
If .Address(False, False) = "A1" Then
If Not IsEmpty(.Value) And IsNumeric(.Value) Then
dAccumulator = dAccumulator + .Value
Else
dAccumulator = 0
End If
Application.EnableEvents = False
.Value = dAccumulator
Application.EnableEvents = True
End If
End With
End Sub
I was able to get it working for the cell I needed "C8" instead of
"A1", but I would like it running on multiple cells (all running an
accumulator). What do I need to change in the code to accomplish this?
The cells I need this for are C8 through O8 & C9 through O9
Thanks!
code on http://www.mcgimpsey.com/excel/accumulator.html
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Static dAccumulator As Double
With Target
If .Address(False, False) = "A1" Then
If Not IsEmpty(.Value) And IsNumeric(.Value) Then
dAccumulator = dAccumulator + .Value
Else
dAccumulator = 0
End If
Application.EnableEvents = False
.Value = dAccumulator
Application.EnableEvents = True
End If
End With
End Sub
I was able to get it working for the cell I needed "C8" instead of
"A1", but I would like it running on multiple cells (all running an
accumulator). What do I need to change in the code to accomplish this?
The cells I need this for are C8 through O8 & C9 through O9
Thanks!