ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   cumulative total (https://www.excelbanter.com/excel-discussion-misc-queries/115526-cumulative-total.html)

George

cumulative total
 
Can anybody help!...Iv got two worksheets, one sheet"MAIN" I enter values in
column A,B and C. The second Sheet"Sheet2", I have as a summary sheet,
keeping totals of columns A,B and C of sheet"MAIN".
What I would like to do is to be able to clear the values in sheet"MAIN"
daily without affecting the values in the summary sheet. In other words, the
totals keep adding in the summary sheet as values are inserted and cleared in
sheet"MAIN".

--
George

Carim

cumulative total
 
Hi George,

To be adapted to your needs :

Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldVal As Variant, NewVal As Variant
If Target.Count 1 Then Exit Sub
Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
If IsNumeric(OldVal) And IsNumeric(NewVal) Then
Target.Offset(0, 1).Value = NewVal + Target.Offset(0, 1).Value
End If
Target.Value = NewVal
Application.EnableEvents = True
End Sub


HTH
Cheers
Carim


Gord Dibben

cumulative total
 
George

Have you thought about what you will do if a mistake in data entry is made?

How will you delete and correct?

Where is the "paper trail" to follow?

What you want can be done in one of several ways(see Carim's post for one
method). but there is no way to check after errors are made.


Gord Dibben MS Excel MVP


On Sun, 22 Oct 2006 07:19:01 -0700, George
wrote:

Can anybody help!...Iv got two worksheets, one sheet"MAIN" I enter values in
column A,B and C. The second Sheet"Sheet2", I have as a summary sheet,
keeping totals of columns A,B and C of sheet"MAIN".
What I would like to do is to be able to clear the values in sheet"MAIN"
daily without affecting the values in the summary sheet. In other words, the
totals keep adding in the summary sheet as values are inserted and cleared in
sheet"MAIN".



George

cumulative total
 
Thanks for the reply. It works fine.
Thank you.
--
George


"Carim" wrote:

Hi George,

To be adapted to your needs :

Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldVal As Variant, NewVal As Variant
If Target.Count 1 Then Exit Sub
Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
If IsNumeric(OldVal) And IsNumeric(NewVal) Then
Target.Offset(0, 1).Value = NewVal + Target.Offset(0, 1).Value
End If
Target.Value = NewVal
Application.EnableEvents = True
End Sub


HTH
Cheers
Carim



George

cumulative total
 
No, I haven`t thought of that.....Have you got a suggestion?
--
George


"Gord Dibben" wrote:

George

Have you thought about what you will do if a mistake in data entry is made?

How will you delete and correct?

Where is the "paper trail" to follow?

What you want can be done in one of several ways(see Carim's post for one
method). but there is no way to check after errors are made.


Gord Dibben MS Excel MVP


On Sun, 22 Oct 2006 07:19:01 -0700, George
wrote:

Can anybody help!...Iv got two worksheets, one sheet"MAIN" I enter values in
column A,B and C. The second Sheet"Sheet2", I have as a summary sheet,
keeping totals of columns A,B and C of sheet"MAIN".
What I would like to do is to be able to clear the values in sheet"MAIN"
daily without affecting the values in the summary sheet. In other words, the
totals keep adding in the summary sheet as values are inserted and cleared in
sheet"MAIN".





All times are GMT +1. The time now is 03:23 PM.

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