Count value in an Excel dynamic cell

Asked

Viewed 57 times

1

I have a cell in excel that is changing value automatically based on the quotation of an action. what I need is to count whenever the value is changed.

The function below works if called only for an active, but if I call the function again for a second active, the counts interfere in the value of one and the other


Private intA As Integer
Private intB As Integer

Function AddSomeNumbers(valor As Integer) As Integer
    
    If valor = 1 And intB = 0 Then
    intA = intA + 1
    intB = 1
    ElseIf valor = 0 And intB = 1 Then
    intA = intA
    intB = 0
    End If
    
    AddSomeNumbers = intA
    
End Function

Grateful

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.