+ Reply to Thread
Results 1 to 5 of 5

Passing a variable range to a formula

  1. #1
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Passing a variable range to a formula

    Greetings all

    I am having a bit of difficulty with getting a sumproduct function to work in a macro. The range is variable in length, so this is how I have entered the formula:

    Please Login or Register  to view this content.
    The variable lrow has been defined previously and the formula works when typed in highlighting the ranges, but the macro crashes when it tries to execute the formula line.

    I could go back and use a helper column if necessary, but I would really prefer to do it in cell.

    Thanks for taking a look at the problem
    Last edited by jacob@thepenpoint; 10-10-2012 at 06:40 PM.
    Jacob Albers
    Excel 2003 & 2010

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Passing a variable range to a formula

    Hi

    try
    Please Login or Register  to view this content.
    You are missing a couple of &

    rylo

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Passing a variable range to a formula

    You can try this (untested)
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    10-16-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2003, 2010
    Posts
    151

    Re: Passing a variable range to a formula

    Thanks Rylo! Thanks Jaslake! That was exactly what was wrong. Quotation marks and Ampersands drive me crazy at times! Thanks again both of you!!

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Passing a variable range to a formula

    Hi Jacob

    Me too
    Quotation marks and Ampersands drive me crazy at times

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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