Button to add contents of A1 to B1, then return A1 to zero

  • I have created a button that will increase A1 by one each time it's clicked. I'd like another button that will add whatever total that is in A1 to B1, then return A1 to zero. I am just discovering vb...


    Thanks for your time.

  • Re: Button to add contents of A1 to B1, then return A1 to zero


    Thanks Alan, but for whatever reason I had to delete the <AddandZero()> to make it work. Otherwise nothing happened. Also, I realized that I don't actually want A1 to return to zero but to return to the formula that was actually in A1, ie =SUM(A2). Is this possible?


    Thanks.

  • Re: Button to add contents of A1 to B1, then return A1 to zero


    El Gallo,


    Try something like this:

    Code
    Sub Test()
        Range("B1").Value = Range("B1") + Range("A1")
        Range("A1") = "=SUM(A2)"
    End Sub

    Matt Mickle
    Using Excel 2010,2013 & 2016

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!