Results 1 to 4 of 4

Thread: Customizing subtotals in Excel

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    Oxford UK
    Posts
    76

    Question Customizing subtotals in Excel

    Hi everyone, I have an Excel form written in vb that adds data onto a sheet.
    How do I get subtotals automatically added to the sheet at the end of each month?

    Thanks
    Last edited by thelocaluk; Dec 21st, 2005 at 08:43 AM.

  2. #2
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Customizing subtotals in Excel

    This is Excel VBA ... I hope it helps ...
    Code:
    Option Explicit
    Sub Macro1()
        Dim aRange As Range
    
        'The range to apply subtotals can be calculated programmatically
        Set aRange = Range("A1:C14")
        
        'Turn On Subtotals in the range
        'This groups on Column A ... figure it out by Recording a macro to do what you want.
        aRange.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3), _
            Replace:=True, PageBreaks:=False, SummaryBelowData:=True
    End Sub
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    Oxford UK
    Posts
    76

    Re: Customizing subtotals in Excel

    Thanks for your reply Webtest, I can see how that works but how do I get it to subtotal at the end of each month only?

  4. #4
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Customizing subtotals in Excel

    I don't understand what you are getting at. Do you mean that you don't want the Grand Total row ... ony the Monthly Subtotal rows? If that is the case, you will have to do the Subtotal operation, and then search for and delete the "Grand Total" row.

    As far as I know, there is no way to prevent the Grand Total row from being created.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width