View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Please help me get this accumulator working

Hi
try the following code (see:
http://www.mcgimpsey.com/excel/accumulator.html):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Static accumulator As Double
With Target
If .Address(False, False) = "C5" Then
If Not IsEmpty(.Value) And IsNumeric(.Value) Then
accumulator = accumulator + .Value
Else
accumulator = 0
End If
Application.EnableEvents = False
.Value = accumulator
Application.EnableEvents = True
End If
End With
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Bill Craig wrote:
I've read everything in this group about how to get an accumulator
going. Here's my task:

DailyClosingEntry SummaryClosingEntry
Cash Cash
Credit Credit
Etc. Etc.

Here's the code I'm trying:

(in the DailyClosingEntry Worksheet module)

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address(False, False, , False) = _
Worksheets("DailyClosingEntry").Range("C5") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False

Worksheets("SummaryClosingEntry").Range("C5").Valu e= _

Worksheets("DailyClosingEntry").Range("C5").Value+ .Value
Application.EnableEvents = True
End If
End If
End With

End Sub

Result: Nothing in the SummaryClosingEntry cell. What am I doing
wrong?

Thanks in Advance.