Can I do the following: Cell1+Cell2=NewCell1?

spk4life

New Member
Joined
Oct 18, 2015
Messages
5
I want to be able to have somewhat of an automatic calculator. I want to keep score of certain data into only one cell. For example.

Cell 1 starts off at 0. When I input 5 on cell 2, it adds it to cell 1 and cell 1 becomes 5. If I then input 10 on cell 2, it would add it to cell 1 again and cell 1 would be 15. Cell 2 would stay blank all the time adding whatever number I input, into cell 1.
 
I did discover a way to return the cell value in column 3 back to nothing after adding the values.
Try this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo J
Dim Lastrow As Integer
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

    If Target.Column = 3 And Target.Row < Lastrow + 1 And Target.Value > 0 Then
        Target.Offset(0, -1).Value = Target.Offset(0, -1).Value + Target.Value
        Target.Value = ""
    End If

Exit Sub
J:
MsgBox "Invaid Value"
End Sub
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,925
Messages
6,175,421
Members
452,640
Latest member
steveridge

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