hi
I try to create index so that whenever the value of cell A1 is different from the value of cell B1, it is added to the variable N one
The code I wrote:
Private Sub Worksheet_Change (ByVal Target As Range)
If Cells (1, 1) .Value <> Cells (1, 2) .Value Then
Cells (1, 2) .Value = Cells (1, 1) .Value
N = N + 1
End If
Cells (N, 3) .Value = 10
End Sub
The problem that the variable N always zero (0)(Although the condition is met) and is not updated according to what is written which prevents the execution of the last command because the variable N is zero.
in Regular model code works fine and the variable is added to it at a time that the condition exists, but I want to work within a macro event?
any help please
Bookmarks