Running total question
Hi Mike:
You need to use a marco (VBA) and it needs to be placed in the code for the
worksheet where you want the total to be kept.
To place it these right click on the sheet tab at the bottom of te screen
and select 'View Code' then paste te following code in there.
It also checks for non-numerical values.
Option Explicit
Const csCellValue As String = "C4"
Const csCellAns As String = "E4"
Const csWarningStart As String = "The value in cell "
Const csWarningEnd As String = " should be a number!"
Const csWarningCaption As String = "Error..."
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Me.Range(csCellValue)) Is Nothing) Then
If Not IsNumeric(Me.Range(csCellValue)) Then
MsgBox csWarningStart & csCellValue & _
csWarningEnd, vbCritical + vbOKOnly, _
csWarningCaption
ElseIf Not IsNumeric(Me.Range(csCellAns)) Then
MsgBox "Value in cell " & csCellAns & _
" should be number", vbCritical + vbOKOnly, _
csWarningCaption
Else
Me.Range(csCellAns) = _
Me.Range(csCellValue) + Me.Range(csCellAns)
End If
End If
End Sub
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.
"Mike Hyndman" wrote:
I am looking for a formula or function that will allow the display of a
running total.
If say, I have a value in C4 and this value is repeated in E4, I would like
to be able to replace the value in C4 and have it added to what was shown in
E4.
So the value of E4 would continually increase by the value of what was
inputted into C4.
TIA
Mike Hyndman
|