Make a number in a cell auto dissapear

New Contributor

Hello all,


I have tried to find an answer but cant, please help. What i cant work out is, I need to have two cells A and b, cell a i put 50 into and have cell b add it, once i hit enter i want i want cell a to go blank waiting for the next entry. So next i put 50 into cell a and then hit enter and have cell b show 100 while cell a goes blank again waiting for the next number. Any help would be really appreciated.

3 Replies

@Peterpete_H You need to put a piece of code in the worksheet where you want this automatic sum and clear to occur.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 1 Then
   ThisRow = Target.Row
   Range("B" & ThisRow).Value = Range("B" & ThisRow).Value + Range("A" &ThisRow).Value
   Range("A" & ThisRow).Clear
End If
End Sub

Open the Visual Basic editor and copy this code into the worksheet area.

Screenshot 2020-08-13 at 06.51.17.png

@Riny_van_EekelenThank you so very much am doing it now, i knew there had to be a way and im out of my depth but learning.


Thank you again,  Peter

@Peterpete_H You're welcome!