Sum up Cell Values

jerryg72

New Member
Joined
Dec 30, 2005
Messages
40
I'm new to this forum and it seems very much helpful for an intermediate like me on excel. I've got a question for you excel experts. I would like to know if you could add the cell values when I type in new digits. For Example. if A1 is 136 and when I type in 10 in A1 (same cell) is there any way (formula, macros or vba scripts) that the Value of A1 change to 146? All the help and assistance in this matter would be highly appreciated. :cool:
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this for the sheet you want this to happen on:

Code:
Public x

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
If Target = "" Then
    x = 0
    Exit Sub
End If
Application.EnableEvents = False
    Target = Target + x
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$A$1" Then x = Target
End Sub
 
Upvote 0
Thank you very much hotpepper, thats exactly what I wanted. I appreciate your quick response. One more quick question, what if I need this in more than one cell?
 
Upvote 0
I told A1 as an example, but in real I need this in d3 thru d6, then d8, d10, d12, d14, d16, d18, d20, d22, d24, and d29 thru d32. Thanks for your assistance again.
 
Upvote 0
Give this a try:

Code:
Public x
Public r As Range

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, r) Is Nothing Then Exit Sub
If Target = "" Then
    x = 0
    Exit Sub
End If
Application.EnableEvents = False
    Target = Target + x
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If r Is Nothing Then _
    Set r = Union(Range("D3:D6"), Range("D8"), Range("D10"), Range("D12"), _
        Range("D14"), Range("D16"), Range("D18"), Range("D20"), Range("D22"), _
        Range("D24"), Range("D29:D32"))
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, r) Is Nothing Then x = Target
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,037
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top