+ Reply to Thread
Results 1 to 11 of 11

VBA to sum

  1. #1
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    VBA to sum

    Hi,

    Please find attached file with a code.

    After excuting the code. two columns with heading of "No. of Claims" will be created.

    I tried Lot. But couldnt make it.

    I need to have sum calculation same as given below amount. means I need total numbers in Cell F15 and K15.

    Also wanted to add text "Grand Total" below the alphabets (in cell E15 and J15) with Bold font same as sum.

    And wanted to give heading to newly created columns by merging cells as mentioned in the sheet 1.
    Refer cell B5, E5 and J5. Pls note my data range will change from time to time. It will always not start from B6. Hence Wants to give heading on immediate row above the table.
    Attached Files Attached Files
    Last edited by winmaxservices; 08-17-2019 at 04:09 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA to sum

    Quote Originally Posted by winmaxservices View Post
    ... And wanted to give heading to newly created columns by merging cells as mentioned in the sheet 1...
    Sheet1 ? Here you only have 07_Sheet

    Quote Originally Posted by winmaxservices View Post
    ... my data range will change from time to time. It will always not start from B6. Hence Wants to give heading on immediate row above the table ...
    explain, please
    Last edited by mjr veverka; 08-17-2019 at 04:36 PM.

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

    Arrow

    Hi,

    you must see this tread

    If I were a moderator I surely compare the IP addresses !

  4. #4
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to sum

    Yes. I want to run code in sheet 7. Given desired result also on onther sheet.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA to sum

    Quote Originally Posted by Marc L View Post
    If I were a moderator I surely compare the IP addresses !
    There is no such need, in the file option "about the author" is the same person ...

    Quote Originally Posted by winmaxservices View Post
    ...Given desired result also on onther sheet.
    For example, instead of:
    Please Login or Register  to view this content.
    you can write:
    Please Login or Register  to view this content.
    'rRng' because 'Rng' is property of 'Sort' object.

    For example, instead of:
    Please Login or Register  to view this content.
    you can write:
    Please Login or Register  to view this content.
    And formatting at the end of the code, e.g.:
    Please Login or Register  to view this content.
    , etc.

    But you can try something simpler:
    Please Login or Register  to view this content.
    Half of the code is used to format the sheet.

  6. #6
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to sum

    Hey porucha vevrku,

    You damn good. Thanks a ton.

  7. #7
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to sum

    Hi porucha vevrku,

    I need one more. In same table I need to give some comments on table. I have added below code end of your code.

    Please Login or Register  to view this content.
    Similarly I have insert many comments by concatenating multiple cells.


    Can you give me one blanket code to select the desired cell. so that I can use the code by changing the cell reference or range.

    I mean , like
    For value in Cell E7 = (column number 0 from newly copied first column (i.e. E), row number 2,) .value . Please link this with n. so that If I change constant value the code will change accordingly.

    For value in Cell G7 = (column number 2 from newly copied first column (i.e. E), row number 2,) .value
    For value in Cell G11 = (column number 2 from newly copied first column (i.e. E), row number 6,) .value


    Also for sum column also in similar way like

    Total of first sum value (F15) = (first copied column (E) + go to "Grand Total", 1).value
    Total of third sum value (H15) = (first copied column (E) + go to "Grand Total", 3).value


    Also for percentage
    Like for value of "H8" (first copied column (E) + 3, value of n-n+2)
    Like for value of "I11" (first copied column (E) + 3, value of n-n+5)
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA to sum

    If I understood correctly, something like that ?
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to sum

    This is what I exactly wanted genius.........

  10. #10
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to sum

    Hi porucha vevrku,
    I need one last help from same code.

    1)
    If I add, more columns in sheet 07_Sheet after Coulmn D, Our code overwirtes the data.

    For Example, Now I added one more column in after column "D", i.e. average. After running the code our the average column disappears.

    Can you chagne the code to run after the last column in actual data. Because I might be adding more columns after after column D one after one.

    But Our code and calculation is going to be same


    2) 'Summary descriptions

    Can you help me to add few more lines as below after exiting lines?

    Total number as per Actual data is 12240 i.e. C23
    Total Amount as per Actual data is 9794255 i.e. D23
    Total Average as per Actual data is 800 i.e. E23

    No. of Claims in only top % 6,696 i.e. G15
    Amount in only top % 5,377,128 i.e. H15
    SOW in only top % 100.00% i.e. I15
    No of claims (%) in only top % 100.00% i.e. J15

    No. of Claims in On ALL 6,696 i.e. L15
    Amount in On ALL 5,377,128 i.e. M15
    SOW in On ALL 54.90% i.e. N15
    No of claims (%) in On ALL 54.71% i.e. O15
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA to sum

    Ad 1. "One topic = One question", don't enlarge/expand/extend your requirements on and on/indefinitely/ad infinitum in accordance with the solutions you received. If you need solutions to your issues that appeared in an existing topic but don't fall within it, then create a new topic, the solutions of others can be many times better.
    Ad 2. When it comes to "Summary descriptions", you already have the procedure scheme, just use it to extend the description fields.

+ 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