+ Reply to Thread
Results 1 to 8 of 8

VBA to subtotal by test and highlight the subtotal row with light gray

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Virginia beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    57

    VBA to subtotal by test and highlight the subtotal row with light gray

    good morning,

    I have an excel worksheet which is link to a simple access database. I would like to be able to subtotal by agent name (column A) using Total Shipped Price (Column L) and then highlight each subtotal row with light gray. Here is the twist, Each month I will open this worksheet and hit refresh button to bring in new agent names and amount. I need the worksheet continue to sub total using an agent name and Total shipped Price.

    I have attach an example and the first tab is the raw data (download from link query) and the second tab is what worksheet should look like after the agent name is group and total.

    I will have split this data from the master into four tabs within this worksheets AOEC, AOCC, AOWC (colunm N)

    My customer does not want me to use the tool outline and group command (the side bars confuse them). The second tab is what is sent to my customer.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    Run this macro after you have the new data in the Raw Data sheet.


    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Virginia beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    That is most coolest macro You just save me hours of work with a push of a button. Thank you so much.

  4. #4
    Registered User
    Join Date
    05-25-2012
    Location
    Virginia beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    I have one more request: Is it possible to have add all of the subtotal amounts or a total of individual lines (which every is easiest for you) under the column called "Total Shipped Price" (Column L) for worksheets master, AOEC, AOCC, AOWC? See attachment for example.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    This uses an old accounting trick for summing a range with subtotals created by SUM functions - to get the grand total, just sum the entire column and divide by 2, so when you see the Total: formula, it is going to look strange with that /2 included.


    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-25-2012
    Location
    Virginia beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    I would love to be able to use excel to the full capability. It work on the master worksheet but not the other worksheets called AOEC, AOCC and AOWC.

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    What doesn't work? Click the button on the first sheet...
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-25-2012
    Location
    Virginia beach, Virginia
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: VBA to subtotal by test and highlight the subtotal row with light gray

    I understand now, thank you and have a great day

+ 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. Test if subtotal exists
    By jmicdk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2016, 12:51 PM
  2. Im New...if subtotal exists then remove. if subtotal doesnt exist do nothing
    By ci89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2015, 04:53 PM
  3. need subtotal to also include the matching data in subtotal line
    By baby_kay_2003 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-15-2014, 12:43 AM
  4. Replies: 1
    Last Post: 09-18-2013, 04:10 PM
  5. Replies: 8
    Last Post: 07-31-2012, 09:41 AM
  6. 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
  7. Replies: 3
    Last Post: 03-08-2006, 05:25 PM

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