Intergrate a cell

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I have a pulse (either a "1" or "0") that inputs to a
single cell. Over a period of time (30 days) I need to
count the number of "1" that occurred at that one cell.
The input cell will either have a "1" or a "0" at any time,
no other inputs.
Thanks Tw
 
This works for the SAME cell. To start over use 0

Option Explicit

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