+ Reply to Thread
Results 1 to 3 of 3

sum dynamic named range

  1. #1
    Registered User
    Join Date
    09-18-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    5

    sum dynamic named range

    I have created named ranges using a For, Next loop.

    Eg.
    For j = 1 to 9
    ...
    results - MVTOP1, MVTOP2...MVTOP9

    Now I want to sum a range of cells using these named ranges. I cannot get the R1C1 formula to work! I have tried many many combinations - quotations in, out, moved.
    CAn someone help?


    This formula gives me the exact result I want:
    ActiveCell.FormulaR1C1 = "=SUM(mvtop1:mvbottom1)"
    But I want the mvtop and mcbottom to cycle through from 1 to 9.

    This is what I currently am trying - without any luck:
    'ActiveCell.FormulaR1C1 = "=SUM(" & "mvtop" & j" & ":" & "mvbottom" & j" & ")"


    ?????????????

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: sum dynamic named range

    You have extra quotes after each j - try it like this:

    Please Login or Register  to view this content.
    (I've also simplified it slightly)

    In future, wrap code tags around any bits of VBA, like above.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    09-18-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: sum dynamic named range

    THANK YOU so much!
    That totally worked.
    Christina

+ 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