Input dollar amount into a cell that updates another cell and more

B

Bill

Help!

I am racking my brain trying to figure out how to input a dollar figure into
a cell (A1)that updates another cell (A2) with the running total (easy to do)
but the hard part is when you want to add in the next dollar figure in the
same cell (A1) but you want to increase the value in A2 by this new number.

Why do I want to do this?

I have created a spreadsheet for a game and instead of using paper money I
want to be able to increase or decrease the player's dollar amount by having
the player (knows nothing about excel) input the dollar amount they want to
either increase or decrease their running total by and I want to keep it
simple for the player so they do have to add formulas when they enter the new
dollar figure.

Hope this makes sense?
 
M

Mike H

Hi,

You need a macro, right click your sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And IsNumeric(Target) Then
Application.EnableEvents = False
Range("A2").Value = Range("A2").Value + Target.Value
Application.EnableEvents = True
End If
End Sub

Mike
 
D

Don Guillett

Right click sheet tab>view code>copy/paste this. Change cell address to
suit.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
With target
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + .Value
Application.EnableEvents = True
End If
End If
End With
End Sub
 
B

Bill

Peo you are awesome!

This exacting what I want to do and now I will teach myself how to create a
macro in order to make this work.

Thanks again,

Bill
 
B

Bill

Thanks Don

Works like charm!

Don Guillett said:
Right click sheet tab>view code>copy/paste this. Change cell address to
suit.

Private Sub Worksheet_Change(ByVal target As Excel.Range)
With target
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + .Value
Application.EnableEvents = True
End If
End If
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
B

Bill

Thanks Mike for your help!

Mike H said:
Hi,

You need a macro, right click your sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And IsNumeric(Target) Then
Application.EnableEvents = False
Range("A2").Value = Range("A2").Value + Target.Value
Application.EnableEvents = True
End If
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top