I would write code for few columns that perform that
Cell 1 -Cell 2 +Cell 3 = Cell3(new)
However I can only write for one cell, cant perform in one column, and if I never clear the value in cell 1 or cell 2, it will still work like the formula
I want to perform like
if I never change the value in cell1 or cell2, then the value for the cell performed in the formula will be 0
just like said I enter the value in cell 1 is 2 and cell 2 is 1 and original value in cell 3 is 2
so the result is 2-1+2=3
but next time I change the value in cell 1 to 3 and I did not clear the cell 2 , I want it to performed like
3-0+3=6
instead of .
3-1+3=5
Cell 1 -Cell 2 +Cell 3 = Cell3(new)
However I can only write for one cell, cant perform in one column, and if I never clear the value in cell 1 or cell 2, it will still work like the formula
I want to perform like
if I never change the value in cell1 or cell2, then the value for the cell performed in the formula will be 0
just like said I enter the value in cell 1 is 2 and cell 2 is 1 and original value in cell 3 is 2
so the result is 2-1+2=3
but next time I change the value in cell 1 to 3 and I did not clear the cell 2 , I want it to performed like
3-0+3=6
instead of .
3-1+3=5
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not (Intersect(Target, Range("A,B")) Is Nothing) Then
Range("C").Value = Range("A").Value - Range("B").Value + Range("C").Value
End If
End Sub
Last edited by a moderator: