Sum to start to end of the row

  • Please see the sample sheet
    When you click on the command button the total is taken horizontally and vertically and written in their proper column.
    for Vertical total is taken from D7:D9 till the end of the column.
    For horizontal total is taken from D7:O7 for all 3 rows.


    If you now insert a row then the total is taken from D8:D10 where as I require from D7:D10
    Same if you insert a column.


    If you delete the column for formula should also change accordingly.


    The rows and columns changes frequently so the last row and column should be taken into account


    I hope the explanation is clear

  • Re: Sum to start to end of the row


    Skamat


    Why do you need vba for the table? Once the Totals are in place the job is done. As long as you set up your table correctly as you add rows and Columns the Sum formula will adjust to pick up the new ranges. Just don't see the point of VBA when a simple sum formula works fine.


    Take care


    Smallman

  • Re: Sum to start to end of the row


    I have long list of data that changes frequently.
    And so I need the formula so that I do not have to change the VBA code everytime.

  • Re: Sum to start to end of the row


    Yeah that is a good idea. Just use formula now you don't need vba. Set your file up so there is one blank line and one blank column before your totals and have the formula include that blank line. Now you are sorted with a solution and no vba required. Winning!!!


    Smallman

Participate now!

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