Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Adding the changes to only one Cell

I am trying to add any changes to E4 to F4 as a running total. I want F4 to
keep adding to itself any thing put in E4.

Thanks for any help with this.

Tray
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Adding the changes to only one Cell

Right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal target As Range)
Application.EnableEvents = False
If target.Address = "$E$4" And IsNumeric(target) Then _
Range("f4").Value = Range("f4") + target
Application.EnableEvents = True
End Sub

And, if you want e4 to change when you change e4

Option Explicit
Dim oldvalue As Double

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address = "$E$4" Then
On Error GoTo fixit
Application.EnableEvents = False
If target.Value = 0 Then oldvalue = 0
target.Value = 1 * target.Value + oldvalue
oldvalue = target.Value
fixit:
Application.EnableEvents = True
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tgivin" wrote in message
...
I am trying to add any changes to E4 to F4 as a running total. I want F4 to
keep adding to itself any thing put in E4.

Thanks for any help with this.

Tray


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Adding the changes to only one Cell

Exactly what I needed. Thanks

"Don Guillett" wrote:

Right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal target As Range)
Application.EnableEvents = False
If target.Address = "$E$4" And IsNumeric(target) Then _
Range("f4").Value = Range("f4") + target
Application.EnableEvents = True
End Sub

And, if you want e4 to change when you change e4

Option Explicit
Dim oldvalue As Double

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address = "$E$4" Then
On Error GoTo fixit
Application.EnableEvents = False
If target.Value = 0 Then oldvalue = 0
target.Value = 1 * target.Value + oldvalue
oldvalue = target.Value
fixit:
Application.EnableEvents = True
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tgivin" wrote in message
...
I am trying to add any changes to E4 to F4 as a running total. I want F4 to
keep adding to itself any thing put in E4.

Thanks for any help with this.

Tray



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Adding the changes to only one Cell

Just be warned.............you will have no "paper trail" for error checking.


Gord Dibben MS Excel MVP

On Thu, 4 Oct 2007 07:18:00 -0700, tgivin
wrote:

Exactly what I needed. Thanks

"Don Guillett" wrote:

Right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal target As Range)
Application.EnableEvents = False
If target.Address = "$E$4" And IsNumeric(target) Then _
Range("f4").Value = Range("f4") + target
Application.EnableEvents = True
End Sub

And, if you want e4 to change when you change e4

Option Explicit
Dim oldvalue As Double

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address = "$E$4" Then
On Error GoTo fixit
Application.EnableEvents = False
If target.Value = 0 Then oldvalue = 0
target.Value = 1 * target.Value + oldvalue
oldvalue = target.Value
fixit:
Application.EnableEvents = True
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tgivin" wrote in message
...
I am trying to add any changes to E4 to F4 as a running total. I want F4 to
keep adding to itself any thing put in E4.

Thanks for any help with this.

Tray




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
adding a formul to the next cell only with the next cell number Janis Excel Discussion (Misc queries) 1 July 30th 07 10:05 PM
Adding numbers in one cell and showing total in seperate cell Deernad Construction Excel Discussion (Misc queries) 12 November 29th 05 07:32 PM
Adding everything but last cell Anthony Slater Excel Discussion (Misc queries) 3 September 7th 05 03:40 PM
Adding the same cell in different worksheets. Can that cell be variable? ro Excel Worksheet Functions 0 August 18th 05 06:31 AM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM


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

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

About Us

"It's about Microsoft Excel"