How to perform cumulative addition in excel V6=V6+T6

S

Sadhana

I want to ask how to initialize a cell with a value and also I want to
perform calculation like..the previous value gets added to current value..
like I have value in cell
T6=23
initially V6=0
now V6=V6 + T6
ie V6= 23
Now I want to change T6=20
So the Value of V6 now becomes = 43
 
B

Bernie Deitrick

Sadhana,

You can do it using the change event.

Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$T$6" Then Exit Sub
Application.EnableEvents = False
Range("V6").Value = Range("V6").Value + Target.Value
Application.EnableEvents = True
End Sub
 
Top