Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Keep adding to one cell to carry a total in another

Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in A2

any help would be appreciated


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 698
Default Keep adding to one cell to carry a total in another

Try this in the sheet module.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target < Range("A1") Then
Range("A1").Select
Exit Sub
End If

Application.EnableEvents = False
Range("A2").Value = Range("A1").Value + Range("A2").Value
Target.Select
Application.EnableEvents = True

End Sub

HTH
Regards,
Howard

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in
A2

any help would be appreciated




  #3   Report Post  
Posted to microsoft.public.excel.newusers
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Keep adding to one cell to carry a total in another

Hi Howard

I'm sure what you have provide will be helpful unfortunately I really am a
beginner and Im not sure where I should actually be entering this. I thank
you for your patience and possibly a little more information.

Thanks

"L. Howard Kittle" wrote:

Try this in the sheet module.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target < Range("A1") Then
Range("A1").Select
Exit Sub
End If

Application.EnableEvents = False
Range("A2").Value = Range("A1").Value + Range("A2").Value
Target.Select
Application.EnableEvents = True

End Sub

HTH
Regards,
Howard

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in
A2

any help would be appreciated





  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Keep adding to one cell to carry a total in another



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in
A2

any help would be appreciated



  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Keep adding to one cell to carry a total in another

Right click sheet tabview codecopy/paste this.
Now when you put a number in cell a1 cell a2 will increase by that number.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address < "$A$1" Then Exit Sub
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in
A2

any help would be appreciated





  #6   Report Post  
Posted to microsoft.public.excel.newusers
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Keep adding to one cell to carry a total in another

AWESOME, thanks Don that did the trick. Now Im wondering how to do it again
on 2 different columns for example K2 & P2 on the same sheet. Is there a way
to just add to this formula or does it have to be added separately? I tried
adding it below the original one you provided but it keeps coming up with the
error message: €œambiguous mane detected worksheet_change€

Thanks you have just saved me an incredible amount of time. ïŠ


"Don Guillett" wrote:

Right click sheet tabview codecopy/paste this.
Now when you put a number in cell a1 cell a2 will increase by that number.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address < "$A$1" Then Exit Sub
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total in
A2

any help would be appreciated




  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Keep adding to one cell to carry a total in another

Add it INSIDE the change event. There can only be ONE per tab.
Private Sub Worksheet_Change(ByVal target As Excel.Range)

If target.Address = "$A$1" Then
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
end if

If target.Address = "$P$1" Then
Application.EnableEvents = False
[p2] = target.Value + [p2]
Application.EnableEvents = True
end if

'etc
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
AWESOME, thanks Don that did the trick. Now Im wondering how to do it
again
on 2 different columns for example K2 & P2 on the same sheet. Is there a
way
to just add to this formula or does it have to be added separately? I
tried
adding it below the original one you provided but it keeps coming up with
the
error message: €œambiguous mane detected worksheet_change€

Thanks you have just saved me an incredible amount of time. ïŠ


"Don Guillett" wrote:

Right click sheet tabview codecopy/paste this.
Now when you put a number in cell a1 cell a2 will increase by that
number.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address < "$A$1" Then Exit Sub
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that
will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total
in
A2

any help would be appreciated





  #8   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Keep adding to one cell to carry a total in another

Even better.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If Not Intersect(target, Range("a1,k1,p1")) Is Nothing Then
Application.EnableEvents = False
target.Offset(1) = target.Offset(1) + target
Application.EnableEvents = True
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
Add it INSIDE the change event. There can only be ONE per tab.
Private Sub Worksheet_Change(ByVal target As Excel.Range)

If target.Address = "$A$1" Then
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
end if

If target.Address = "$P$1" Then
Application.EnableEvents = False
[p2] = target.Value + [p2]
Application.EnableEvents = True
end if

'etc
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
AWESOME, thanks Don that did the trick. Now Im wondering how to do it
again
on 2 different columns for example K2 & P2 on the same sheet. Is there a
way
to just add to this formula or does it have to be added separately? I
tried
adding it below the original one you provided but it keeps coming up with
the
error message: €œambiguous mane detected worksheet_change€

Thanks you have just saved me an incredible amount of time. ïŠ


"Don Guillett" wrote:

Right click sheet tabview codecopy/paste this.
Now when you put a number in cell a1 cell a2 will increase by that
number.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address < "$A$1" Then Exit Sub
Application.EnableEvents = False
[a2] = target.Value + [a2]
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mex" wrote in message
...
Hi
I want to be able to use one cell to keep adding new numbers to that
will
accumulate the total in another cell.
Ex: I use A1 as the cell to input a new number that will carry a total
in
A2

any help would be appreciated






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 entry in one cell to a running total in another cell TommyB Excel Worksheet Functions 1 March 11th 09 11:11 PM
How do I automaticly carry a month end total over angel Excel Worksheet Functions 1 January 14th 09 11:26 AM
carry down total belvy123 Excel Discussion (Misc queries) 16 March 10th 07 05:59 PM
Calculate intermediate total on page change and carry it over. Rahul Gupta Excel Discussion (Misc queries) 2 July 17th 06 04:46 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


All times are GMT +1. The time now is 06:02 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"