Macro For Automatically Creating A Subtotal

  • I am a new member here, but going by the threads I have read so far hopefully someone is able to help me.

    I have recently been to a excel course where the presenter was very fond of excel's SUBTOTAL formula that he wrote a macro so that he had a toolbar button similar to the built-in autosum function. Can anyone post the code that I need to paste into VBA for this to work?

    If possible I would like to have the formula to have a Function Number of "9" (ie. SUM), but would stop/wait for me to select the cell range (either rows or columns).
    In case you are wondering why I want this, I am an Accountant and sometimes I have to analysis cashbooks or cashflows and would like to have a subtotal for each section without have 12 additions for the year to date figure.

  • Re: Macro For Automatically Creating A Subtotal

    I think [pt]*[/pt] would be more valuable,to use subtotals the data will first need sorting, not with Pivottables.

    More to read on the subject of PivotTables in the Tutorials section here. If you are planning to learn VBA then also look at the Recordig macros tutorial there, to see how to add a menu Button. The Macro Recorder can also provide the basic code for subtotals

Participate now!

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