+ Reply to Thread
Results 1 to 7 of 7

VBA code for sub total

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    89

    VBA code for sub total

    Need sub total VBA code. Attached the sample file. It is not a constant row. Sometime total field in 4th row or 8th row depends upon the data.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: VBA code for sub total

    1. What determines where the TOTAL goes?
    2. Have you considered using the built-in GROUP or SUBTOTAL functions instead?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: VBA code for sub total

    It should apply Sum() fucntion of the row where "Total" mentioned.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,706

    Re: VBA code for sub total

    If it is allowable to modify the setup of the sheet then you could put the following formula in cell C2 and copy down, as shown in the attached file:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: VBA code for sub total

    it is okay but i need VBA code on the same column "B6" & "B11". Row number is not constant sometimes it would be "B8" or "B20".

  6. #6
    Registered User
    Join Date
    04-04-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: VBA code for sub total

    vba code to subtotal of the blank address

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA code for sub total

    Maybe:

    Please Login or Register  to view this content.

+ 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. [SOLVED] How to protect total workbook using below code
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2017, 04:22 AM
  2. Capturing Total of project code
    By thong127 in forum Excel General
    Replies: 1
    Last Post: 12-09-2015, 01:58 PM
  3. Code to calculate total
    By shotta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2013, 04:39 PM
  4. Code that will add a grand total row
    By n_lindsey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 03:34 PM
  5. code for adding a '% of total' column
    By overcanyon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-19-2005, 01:30 PM
  6. [SOLVED] Help required to code a '% of total' column
    By overcanyon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2005, 10:25 AM
  7. [SOLVED] VB code to total up a column as the value change on another
    By Fernando in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2005, 04:32 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