ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to perform cumulative addition in excel V6=V6+T6 (https://www.excelbanter.com/excel-worksheet-functions/107698-how-perform-cumulative-addition-excel-v6%3Dv6-t6.html)

Sadhana

How to perform cumulative addition in excel V6=V6+T6
 
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

Bernie Deitrick

How to perform cumulative addition in excel V6=V6+T6
 
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

"Sadhana" wrote in message
...
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





All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com