Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to figure out a macro or a formula that will allow me to keep a
running total when one cell in the formula is constantly changing. Example: Cell B6 contains the number 7 (total for this week) Cell B35 contains the number 36 (year to date total including the 7 for this week) I want to be able to change cell B6 and have the new amount added to the 36 in cell B35 and the answer to that total, replace the year to date total in Cell B35. So, if cell B6 changes to 9 (total for the week) then I want the B35 total to change to the 36 year to date pluse the 9 for the new weekly total and ultimately replace the B35 cell number of 36 with the answer which is 45. Does anyone know how I can do this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is some code for you. At each change in Cell B6, it adds the value of B6
to the existing value of B35 to make a new total in B35. Right click on the sheet tabe where you want the code and select view code (this can not be in a regular module) and add this code... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$6" Then Range("B35").Value = Range("B35").Value + Target.Value End If End Sub -- HTH... Jim Thomlinson "Jaime" wrote: I am trying to figure out a macro or a formula that will allow me to keep a running total when one cell in the formula is constantly changing. Example: Cell B6 contains the number 7 (total for this week) Cell B35 contains the number 36 (year to date total including the 7 for this week) I want to be able to change cell B6 and have the new amount added to the 36 in cell B35 and the answer to that total, replace the year to date total in Cell B35. So, if cell B6 changes to 9 (total for the week) then I want the B35 total to change to the 36 year to date pluse the 9 for the new weekly total and ultimately replace the B35 cell number of 36 with the answer which is 45. Does anyone know how I can do this? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you! Thank you! Thank you!
This makes my job a TON easier. "Jim Thomlinson" wrote: Here is some code for you. At each change in Cell B6, it adds the value of B6 to the existing value of B35 to make a new total in B35. Right click on the sheet tabe where you want the code and select view code (this can not be in a regular module) and add this code... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$6" Then Range("B35").Value = Range("B35").Value + Target.Value End If End Sub -- HTH... Jim Thomlinson "Jaime" wrote: I am trying to figure out a macro or a formula that will allow me to keep a running total when one cell in the formula is constantly changing. Example: Cell B6 contains the number 7 (total for this week) Cell B35 contains the number 36 (year to date total including the 7 for this week) I want to be able to change cell B6 and have the new amount added to the 36 in cell B35 and the answer to that total, replace the year to date total in Cell B35. So, if cell B6 changes to 9 (total for the week) then I want the B35 total to change to the 36 year to date pluse the 9 for the new weekly total and ultimately replace the B35 cell number of 36 with the answer which is 45. Does anyone know how I can do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need help with running totals | Excel Worksheet Functions | |||
running totals, named formulas | Excel Worksheet Functions | |||
Running totals | Excel Discussion (Misc queries) | |||
Running Totals | Excel Discussion (Misc queries) | |||
Running Totals | New Users to Excel |