+ Reply to Thread
Results 1 to 6 of 6

add subtotal with vba in table

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    55

    add subtotal with vba in table

    Who can help me out?

    In attached file I created,as an example, a table in cells A1-G27.
    What I need is a subtotal for pcs, VATand Amount per Registration Nr. as displayed in cells I1-P7.
    In the cell "subtotal" the "registration Number" should also be included in this cell.

    The original table has 6000 rows. For each registration number I have now to insert a subtotal by hand....

    A solution is much appreciated!

    kind regards, Robert
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: add subtotal with vba in table



    Why do not use Excel basics worksheet functions, why VBA ?

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: add subtotal with vba in table

    Hi Marc, I like to use vba in order to save time by automate this task. Now I have to insert subtotals my self. In the future this task has to be done more often.Thanks for your reply

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this …

    PHP Code: 
    Sub Macro1()
    '
    Macro1 Macro
    ' Macro recorded by The Noob Simulator ! *
    '

    '
        Range("A1").Select
        ActiveCell.ListObject.Unlist
        Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5), _
            Replace:=True, PageBreaks:=False, SummaryBelowData:=True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 11-25-2016 at 07:13 AM.

  5. #5
    Registered User
    Join Date
    01-28-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: add subtotal with vba in table

    Hi Marc, It works great!! Thanks very much! I clicked the star icon Grt Robert

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: add subtotal with vba in table


    Thanks for the rep' !

    Code was created just by activating Macro Recorder and using Excel Data SubTotal function as everyone can do …

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. DISPLAY SUBTOTAL and SUBTOTAL % in PIVOT TABLE
    By excelmr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2015, 05:44 AM
  2. [SOLVED] Add subtotal in Pivot Table
    By jewellove in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-10-2013, 09:32 PM
  3. Subtotal - Delete zero Subtotal and prior rows that calculate to that zero Subtotal
    By Whatsherface in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 08:37 PM
  4. Subtotal within pivot table
    By MARKSTRO in forum Excel General
    Replies: 5
    Last Post: 03-21-2012, 03:00 PM
  5. Pivot Table % of Subtotal
    By darvistor in forum Excel General
    Replies: 5
    Last Post: 11-29-2011, 06:23 PM
  6. Excel 2007 : Subtotal with Pivot Table
    By alcanel in forum Excel General
    Replies: 6
    Last Post: 09-21-2010, 05:31 AM
  7. Pivot Table: % of Subtotal
    By alliseri in forum Excel General
    Replies: 1
    Last Post: 07-22-2009, 04:25 AM

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