I am trying to use a worksheet change event in Excel VBA, but it does not work.
From what I'm compiling, it’s easy enough to define the “Worksheet_Change” control function, as I did here:
Private Sub Worksheet_Change(ByVal Target As Range) Range("J1").Select If Target.Address = "$J$1" And ActiveCell.Value = 1 Then Range("B1").Select Dim c As Integer c = ActiveCell.Value c = c + 1 ActiveCell.Value = c End If End Sub
The problem is that I don’t know exactly where I should determine it. I just put it in "module1", which was automatically generated when I made my first macro. It's right? I am new to VBA, so I don't know about it yet.
source share