Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I am trying to update a cell so that it equals itself + another value.
I am thinking that I will need to use a macro but am not sure about the format of the macro. The cell I am trying to update is called hptotal and I am trying to add the value of the cell called extrahp to it each time the value of extrahp changes. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Set hptotal = Range("A1") Set extrahp = Range("A2") If Intersect(Target, extrahp) Is Nothing Then Exit Sub End If hptotal.Value = hptotal.Value + extrahp.Value End Sub Adjust the addresses of the two cells to meet your needs. -- Gary''s Student gsnu200710 "ruthhicks999" wrote: I am trying to update a cell so that it equals itself + another value. I am thinking that I will need to use a macro but am not sure about the format of the macro. The cell I am trying to update is called hptotal and I am trying to add the value of the cell called extrahp to it each time the value of extrahp changes. -- ruthhicks999 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just make sure you don't make a mistake entering data in A2.
You will never know when it was made and may not be able to recover from it. You would be far safer entering the numbers in a helper column so's you would have a "paper trail" to follow for troubleshooting. Gord Dibben MS Excel MVP On Mon, 12 Mar 2007 06:27:03 -0700, Gary''s Student wrote: Private Sub Worksheet_Change(ByVal Target As Range) Set hptotal = Range("A1") Set extrahp = Range("A2") If Intersect(Target, extrahp) Is Nothing Then Exit Sub End If hptotal.Value = hptotal.Value + extrahp.Value End Sub Adjust the addresses of the two cells to meet your needs. -- Gary''s Student gsnu200710 "ruthhicks999" wrote: I am trying to update a cell so that it equals itself + another value. I am thinking that I will need to use a macro but am not sure about the format of the macro. The cell I am trying to update is called hptotal and I am trying to add the value of the cell called extrahp to it each time the value of extrahp changes. -- ruthhicks999 |
#4
![]() |
|||
|
|||
![]()
Gord please can you explain what you mean by a helper column, I would like a record to be kept ideally but I am not sure how I could go about this.
|
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
A helper column in this case is one where you enter the data and use a formula
elsewhere to gather that data. Say you want A1 to keep a running total of numbers placed in column B........... In A1 enter =SUM(B:B) As you enter numbers down column B, A1 will update. The "paper trail" is in column B. Gord On Wed, 14 Mar 2007 08:52:38 +0000, ruthhicks999 wrote: Gord please can you explain what you mean by a helper column, I would like a record to be kept ideally but I am not sure how I could go about this. |
#6
![]() |
|||
|
|||
![]()
I have been trying to get the Macro to work for a couple of weeks now without success. The main thing that puzzles me is that when I write the macro and save it, when I go back to Tools, Macros, Run it is not even shown as a macro. Through the editor I can see it but again it will not run.
How do I actually get it to run? I want to call this macro from another macro - something that I have not done before, please can you advise on how to do that too. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Very Basic Problem - Merged Cell Equals Contents of a Single Cell | Excel Worksheet Functions | |||
updating a cell value | Excel Discussion (Misc queries) | |||
Updating the Sum of a cell | Excel Worksheet Functions | |||
Macro to remove contents of cell and move all other contents up one row | Excel Discussion (Misc queries) | |||
Cell contents vs. Formula contents | Excel Discussion (Misc queries) |