Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Accumulator cells

Hi all,
Is there a way to modify this code so that it applies to all rows instead of
just the indicated rows? For example....adding a value in D3 will be added to
F3...values added in D10 will be added to F10...and so on....in other words,
I'd like it to apply to the entire columns.

Thanks!

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Accumulator cells

Tom,

Give this a try - the commented cells have been replaced by the one
immediately above:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Column = "4" Then
' If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value + .Value
' Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Column = "3" Then
' If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value - .Value
' Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub


"Tom" wrote:

Hi all,
Is there a way to modify this code so that it applies to all rows instead of
just the indicated rows? For example....adding a value in D3 will be added to
F3...values added in D10 will be added to F10...and so on....in other words,
I'd like it to apply to the entire columns.

Thanks!

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Accumulator cells

That did it...
Thanks Cory!!!

"Cory" wrote:

Tom,

Give this a try - the commented cells have been replaced by the one
immediately above:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Column = "4" Then
' If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value + .Value
' Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Column = "3" Then
' If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value - .Value
' Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub


"Tom" wrote:

Hi all,
Is there a way to modify this code so that it applies to all rows instead of
just the indicated rows? For example....adding a value in D3 will be added to
F3...values added in D10 will be added to F10...and so on....in other words,
I'd like it to apply to the entire columns.

Thanks!

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Accumulator cells Multiple subsets - multiple accumulators

I've ben toying with a similair problem, I need to check the value of two
different rows of a subset of the entire spreadsheet and test to see if the
newer value is smaller than the previous value (the newer) value can be
detected by a date field in a cell on the row. their are 10 cells that I
need to test ultimately to return a percentage of the total quantity of
subsets that had smaller values .

I have tried pulling the data through an autofilter but the cell refrences
differ for each subset -- needles to say my beard is going gray trying to
fit the basic loop to the (varying) subset(s), then accumulating the totals
for each of the test categories.

Any ideas -- I'm vegging and lost -- thanks ;-)


--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.


"Cory" wrote in message
...
Tom,

Give this a try - the commented cells have been replaced by the one
immediately above:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Column = "4" Then
' If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value + .Value
' Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Column = "3" Then
' If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Cells(.Row, "F").Value = Cells(.Row, "F").Value - .Value
' Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub


"Tom" wrote:

Hi all,
Is there a way to modify this code so that it applies to all rows instead
of
just the indicated rows? For example....adding a value in D3 will be
added to
F3...values added in D10 will be added to F10...and so on....in other
words,
I'd like it to apply to the entire columns.

Thanks!

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = ("D3") Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value + .Value
Application.EnableEvents = True
End If
End If
End With
With Target
If .Address(False, False) = "C3" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("F3").Value = Range("F3").Value - .Value
Application.EnableEvents = True
End If
End If
End With
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accumulator BadBoy Excel Worksheet Functions 2 April 24th 09 12:25 PM
accumulator with other than one dan Excel Worksheet Functions 8 November 24th 06 06:29 PM
Adding an accumulator for multiple cells jrambo63 Excel Worksheet Functions 3 May 26th 05 05:50 PM
Please help fix my accumulator Tim McMahon Excel Programming 3 May 23rd 04 09:06 PM
Please help me get this accumulator working Bill Craig[_3_] Excel Programming 1 May 19th 04 10:36 PM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"