Adding Data then clearing the contents of the Cell

DaveA7

New Member
Joined
Aug 27, 2014
Messages
2
Hi, I want to be able to enter data into cell, then once I have entered the data I would like the program to automatically add the contents of that cell to a figure in another cell (A total) then the contents of the cell I entered data into be deleted. I don't mind if instead of the data being deleted, the row that the data is on is automatically hidden either.

For example:

'Enter 5 into cell'
'Press Enter button (Or click button that enables a macro)'
'5 in added to the 'total' 10'
'15 is displayed in the total cell'
'The original cell that data was entered into is now blank and the process can be repeated'

I'm thinking that this could be done using a macro and creating a button to enable that macro but i'm not sure how to do this, any help would be greatly appreciated.

Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Suppose the original cell is at A1, the total cell is at B1, and it's sheet1, then put the following vba code in Sheet1.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

  If Not Intersect(Target, Range("A1")) Is Nothing Then
    Range("B1").Value = Range("B1").Value + Range("A1").Value
    Range("A1").Value = ""
  End If


End Sub
 
Upvote 0
That's great thanks, sorry i'm a bit of a novice with VB code in a sheet, how do I get it to execute within the sheet?
 
Upvote 0
in excel. use alt+ F11 to enter vba editor. under vba project on the upper left, right-click on Sheet1, select view code. Paste the code provided. Now, whenever a value gets entered into A1, the subroutine automatically does its part.
 
Upvote 0

Forum statistics

Threads
1,203,105
Messages
6,053,546
Members
444,670
Latest member
laurenmjones1111

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