Thread: Formula help!!!
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Formula help!!!

No formula, you need VBA

Private mPrev
Const WS_RANGE As String = "H1:H10" '<== change to suit

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then
.Value = .Value + mPrev
End If
mPrev = .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
mPrev = Target.Value
End If
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alex Vega" <Alex wrote in message
...
What is the formula to continually add a number inside a single cell with
itself over and over and total shows up in another cell? Almost like a
running total from 2nd cell from input in 1st cell.

i.e. Cell B2 has an a user input of 1, cell D2 totals 1.
Cell B2 has a user input of 2, cell D2 totals 3
Cell B2 has a user input of 5, cell D2 totals 8, etc.