Excel need cell to update

malverd

New Member
Joined
Jul 28, 2010
Messages
15
Hi,

I have a spreadsheet that has a cell with a value that constantly changes. I also want to have another cell that will keep a cumulative total of the first cell.

Example:
cell A1 has a value of 1
cell C2 would now have a value of 1
cell A1 value changes to 2
cell C2 would now have a value of 3

I'm sure it's easy but I can't for the life of me figure it out.

Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
1. Right click the relevant sheet name tab in workbook1 and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window (after editing the code for your workbook names).
4. Try making some changes in Cell A1 in workbook1

Private Sub Worksheet_Change(ByVal Target As Range)
Dim n As Long
If Target.Rows.Count = 1 And Target.Columns.Count = 1 And Target.Row = 1 And Target.Column = 1 Then
n = Range("C2").Value
Range("C2") = n + Target.Value
End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top