Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 12
Default Updating the contents of a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Updating the contents of a cell

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Updating the contents of a cell

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   Report Post  
Junior Member
 
Posts: 12
Default

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Updating the contents of a cell

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   Report Post  
Junior Member
 
Posts: 12
Default

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
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
Very Basic Problem - Merged Cell Equals Contents of a Single Cell jollynicechap Excel Worksheet Functions 3 December 29th 06 08:16 PM
updating a cell value Ray H. Excel Discussion (Misc queries) 2 February 2nd 06 03:55 AM
Updating the Sum of a cell Teddy54 Excel Worksheet Functions 0 November 18th 05 10:01 PM
Macro to remove contents of cell and move all other contents up one row adw223 Excel Discussion (Misc queries) 1 July 1st 05 03:57 PM
Cell contents vs. Formula contents Sarah Excel Discussion (Misc queries) 3 December 15th 04 06:02 PM


All times are GMT +1. The time now is 09:11 AM.

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"