ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   One cell accumulation (https://www.excelbanter.com/excel-programming/374396-one-cell-accumulation.html)

Vicki

One cell accumulation
 
How do i calculate in one cell without creating a circular reference?

JLGWhiz

One cell accumulation
 
=2*2
Other than that, what specific type of calculation do you want to do?

"Vicki" wrote:

How do i calculate in one cell without creating a circular reference?


Vicki

One cell accumulation
 
I want to create a running total in g3. every time i enter a number in g3 it
will add to itself.


"JLGWhiz" wrote:

=2*2
Other than that, what specific type of calculation do you want to do?

"Vicki" wrote:

How do i calculate in one cell without creating a circular reference?


Jim Thomlinson

One cell accumulation
 
Add this code to the sheet (right click the sheet tab and paste this code)

Private Sub Worksheet_Change(ByVal Target As Range)
Static dblLastValue As Double

If Target.Address = "$G$3" Then
Application.EnableEvents = False
Target.Value = dblLastValue + Target.Value
dblLastValue = Target.Value
Application.EnableEvents = True
End If
End Sub
--
HTH...

Jim Thomlinson


"Vicki" wrote:

I want to create a running total in g3. every time i enter a number in g3 it
will add to itself.


"JLGWhiz" wrote:

=2*2
Other than that, what specific type of calculation do you want to do?

"Vicki" wrote:

How do i calculate in one cell without creating a circular reference?


Alok

One cell accumulation
 
Though what you are trying to accomplish can probably be done in other ways,
here is the code to accumulate the values in the same cell.
Paste this code in the Sheet1's code window.

Dim dTotalInA1 As Double
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells(1).Address = "$A$1" Then
Application.EnableEvents = False
dTotalInA1 = dTotalInA1 + Target.Cells(1).Value
Target.Cells(1).Value = dTotalInA1
Application.EnableEvents = True
End If
End Sub


"Vicki" wrote:

I want to create a running total in g3. every time i enter a number in g3 it
will add to itself.


"JLGWhiz" wrote:

=2*2
Other than that, what specific type of calculation do you want to do?

"Vicki" wrote:

How do i calculate in one cell without creating a circular reference?


Niek Otten

One cell accumulation
 
http://www.mcgimpsey.com/excel/accumulator.html


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Vicki" wrote in message ...
| How do i calculate in one cell without creating a circular reference?




All times are GMT +1. The time now is 12:01 AM.

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