+ Reply to Thread
Results 1 to 8 of 8

Subtotal VBA

  1. #1
    Registered User
    Join Date
    03-18-2007
    Posts
    36

    Subtotal VBA

    Hi there,

    I have a macro that formats a spreadsheet. To finish it off I need code that does the following.

    1) Adds subtotals and a grand total, in bold.

    2) Inserts a blank row after each subtotal.

    3) After the macro has run and the spreadsheet is formatted, any change to the "Amount" column will also update the subtotal and grand total.

    Can anyone help please?

    Thnak you.

    Item PO Date Amount
    PEMS2714 3000086401 24/06/2008 10.00
    PEMT6781 3000087313 10/07/2008 15.00
    67679 3000087313 10/07/2008 20.00
    Jul-08 45.00

    PEMV8998 ST17893 6/08/2008 20.00
    AMAL2773 3000093472 14/08/2008 30.00
    PEMZ8397 3000096172 23/09/2008 40.00
    Sep-08 90.00

    PENA4834 3000098208 1/10/2008 5.00
    PENA5583 3000098772 2/10/2008 25.00
    PENA6627 3000098884 3/10/2008 50.00
    PENA9688 3000097272 7/10/2008 100.00
    Oct-08 180.00

    PEND2968 3000100872 3/11/2008 50.00
    PEND2967 3000100872 3/11/2008 150.00
    Nov-08 200.00

    Total 515.00

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not use a PivotTable?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-18-2007
    Posts
    36

    Subtotal vba

    Hi Bob,

    Thank you for this piece of code.

    I inserted it into my macro but an error occurs at the following line.

    Please Login or Register  to view this content.
    Do you have any suggestions? I could upload the full macro & a source document if that would help?

    Thanks again for all you have done.
    Last edited by royUK; 11-06-2008 at 04:23 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It would help if you said what error, attaching the workbook would probably help

  6. #6
    Registered User
    Join Date
    03-18-2007
    Posts
    36

    Subtotal VBA

    Hi Roy,

    Attached is the macro and a source file (PS.xls) that the macro formats.

    Thanks again.
    Attached Files Attached Files

  7. #7
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Seeing as you only gave a schematic of the data and didn't give the exact layout, you needed to adjust the code to the real columns.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-18-2007
    Posts
    36

    Subtotal VBA

    Hi Bob,

    Thanks for what you have done, I really appreciate it.

    I have tried the code but with my limited ability I am unable to adjust it to fit the actual columns. Attached is a file that shows the layout once the bulk of the formatting has been done.

    Would you be kind enough to adapt this code?

    Thanks again.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1