+ Reply to Thread
Results 1 to 6 of 6

Need VBS to sum value in column H based on selection

  1. #1
    Registered User
    Join Date
    12-21-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Need VBS to sum value in column H based on selection

    Hi.

    I load a sheet with BOM information for multiple parts via cut and paste from another program. At the time of the paste, the data I need is selected. From that selection, I need the code to sum only the data in column H. I'd like to output the total 1 row below the selected cells in column H.

    Note: I will continue down the sheet with other parts, therefore I need the code to reference from the active cell, not a fixed cell (e.g. A1).

    Your guidance would be greatly appreciated.

    Thanks!
    Attached Files Attached Files
    Last edited by Jonathan Keneipp; 12-21-2012 at 08:41 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need VBS to sum value in column G based on selection

    Hi,

    Your post is confusing. Why are you summing the prices in column G and not the SubTotal column H. Furthermore why in the first block are you summingt the prices in G16, then in G17 summing them all again plus G16, and ditto in G17 & G18?

    Please indicate in which cells you expect to see totals and what the totals should be.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    12-21-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Need VBS to sum value in column G based on selection

    Hello Richard:

    Thank you for your comment. I will correct my original post. You are correct, I would like to sum column H. Feel free to ignore the summing in G18. I'll give you background if interested.

    Background: We add X% based on anticipated scrap for that particular build.

    Thanks!

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need VBS to sum value in column G based on selection

    So are you wanting the macro to add the calculated % in I17 & I44 and the totals in I18 & I45? And is the % always 4%?

    Or are I17 & I44 in the original data and you only want to add I18 & I45?

  5. #5
    Registered User
    Join Date
    12-21-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Need VBS to sum value in column G based on selection

    Hello Richard!

    I expect that it will remain 4% for all of 2013. I am looking to add the 4%. I'm happy to adopt a new format to make the spreadsheet more typical. That said, I'm ok with listing the total, listing the 4%, then showing the grand total.

    Thanks!

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need VBS to sum value in column G based on selection

    Hi,

    After you've loaded the data run the following macro

    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)

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