![]() |
Continuall Add ing values in a cell
Hi Everyone-
I suspect that this question has been asked before but it is difficult to know how to find the correct thread. That being said, here it goes. I would like to make a cell continually add values entered into them. For example, I have a cell that has a value of $12.37 and I have to add to it a new value as I encounter it, lets say $8.73. As it stands know, I pull out my trusty calculator andsum up the two values and key in the sum into the field. I have a pile of recites that I need to add as they come up. Any help is greatly appreciated. Manuel A. Ayala CAD Concepts, LLC |
Private Sub Worksheet_Change(ByVal target As Range)
Static nAmount On Error GoTo ws_exit: Application.EnableEvents = False If target.Address(False, False) = "H10" Then target.Value = target.Value + nAmount nAmount = target.Value End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP (remove nothere from the email address if mailing direct) "CAD Concepts" wrote in message ... Hi Everyone- I suspect that this question has been asked before but it is difficult to know how to find the correct thread. That being said, here it goes. I would like to make a cell continually add values entered into them. For example, I have a cell that has a value of $12.37 and I have to add to it a new value as I encounter it, lets say $8.73. As it stands know, I pull out my trusty calculator andsum up the two values and key in the sum into the field. I have a pile of recites that I need to add as they come up. Any help is greatly appreciated. Manuel A. Ayala CAD Concepts, LLC |
Hi Bob- I pasted the code as you suggested but I must be missing something because it doesn't seem to work. Do I have set some format in the cell to make it work? Also, when inputting do I just click on the cell and enter the value I want added to the existing.? Please advise. Thanks. Manuel "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal target As Range) Static nAmount On Error GoTo ws_exit: Application.EnableEvents = False If target.Address(False, False) = "H10" Then target.Value = target.Value + nAmount nAmount = target.Value End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP (remove nothere from the email address if mailing direct) "CAD Concepts" wrote in message ... Hi Everyone- I suspect that this question has been asked before but it is difficult to know how to find the correct thread. That being said, here it goes. I would like to make a cell continually add values entered into them. For example, I have a cell that has a value of $12.37 and I have to add to it a new value as I encounter it, lets say $8.73. As it stands know, I pull out my trusty calculator andsum up the two values and key in the sum into the field. I have a pile of recites that I need to add as they come up. Any help is greatly appreciated. Manuel A. Ayala CAD Concepts, LLC |
Hi,
If you do not get a reasonable response from this forum, you can send your worksheet to me and maybe I can write a macro to dothe task. See some of my excel stuff at: http://www.geocities.com/excelmarksway regards mark -----Original Message----- Hi Everyone- I suspect that this question has been asked before but it is difficult to know how to find the correct thread. That being said, here it goes. I would like to make a cell continually add values entered into them. For example, I have a cell that has a value of $12.37 and I have to add to it a new value as I encounter it, lets say $8.73. As it stands know, I pull out my trusty calculator andsum up the two values and key in the sum into the field. I have a pile of recites that I need to add as they come up. Any help is greatly appreciated. Manuel A. Ayala CAD Concepts, LLC . |
Yes, all you do is enter values. Note the point at the end about where you
put the code. Be aware that this starts afresh for each excel seesion.. -- HTH RP (remove nothere from the email address if mailing direct) "CAD Concepts" wrote in message ... Hi Bob- I pasted the code as you suggested but I must be missing something because it doesn't seem to work. Do I have set some format in the cell to make it work? Also, when inputting do I just click on the cell and enter the value I want added to the existing.? Please advise. Thanks. Manuel "Bob Phillips" wrote: Private Sub Worksheet_Change(ByVal target As Range) Static nAmount On Error GoTo ws_exit: Application.EnableEvents = False If target.Address(False, False) = "H10" Then target.Value = target.Value + nAmount nAmount = target.Value End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP (remove nothere from the email address if mailing direct) "CAD Concepts" wrote in message ... Hi Everyone- I suspect that this question has been asked before but it is difficult to know how to find the correct thread. That being said, here it goes. I would like to make a cell continually add values entered into them. For example, I have a cell that has a value of $12.37 and I have to add to it a new value as I encounter it, lets say $8.73. As it stands know, I pull out my trusty calculator andsum up the two values and key in the sum into the field. I have a pile of recites that I need to add as they come up. Any help is greatly appreciated. Manuel A. Ayala CAD Concepts, LLC |
All times are GMT +1. The time now is 09:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com