Forum Discussion

Peterpete_H's avatar
Peterpete_H
Copper Contributor
Aug 12, 2020

Make a number in a cell auto dissapear

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

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    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.