Forum Discussion

DianaRato's avatar
DianaRato
Copper Contributor
Jun 25, 2021
Solved

Count every time a new value is entered in a Cell

Hello all,   I hope I am able to explain what I want to do properly, so here it goes:   I have two cells that I want to count the values of, but the second cell is constantly being updated with a...
  • PReagan's avatar
    PReagan
    Jun 25, 2021

    Hello DianaRato,

     

    Enter this VBA code as a procedure in the necessary worksheet:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Sheets("Sheet1").Range("A1"), Target) Is Nothing Then
    Range("B1").Value = Range("B1").Value + 1
    End If
    End Sub

     Where...

    • "Sheet1" is the sheet that you want to reference
    • Range("A1") is the range of cells that you want to check for changes
    • Range("B1") is the cell that will add one for each change that is made in the range of cells that you want to check for changes

Resources