+ Reply to Thread
Results 1 to 2 of 2

using a variable in a R1C1 formula

Hybrid View

carsto using a variable in a R1C1... 06-11-2007, 04:30 PM
mudraker ActiveCell.FormulaR1C1 = _ ... 06-11-2007, 05:59 PM
  1. #1
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    using a variable in a R1C1 formula

        ActiveCell.FormulaR1C1 = _
            "=(SUMPRODUCT(SUBTOTAL(3,OFFSET(RC[-7]:R[1000]C[-7],ROW(RC[-7]:R[1000]C[-7])-MIN(ROW(RC[-7]:R[1000]C[-7])),,1)),--(RC[-7]:R[1000]C[-7]>=0)))-1"
    This formula works, but I’d like to change the R[1000] to R[iLastRow], but it doesn’t work.
    Is there a way to include my iLastRow variable into the formula?

    I’m counting the visible lines in a filtered list because I only want to print the listing if there is actual data.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    ActiveCell.FormulaR1C1 = _
            "=(SUMPRODUCT(SUBTOTAL(3,OFFSET(RC[-7]:R[" & ilastrow & "]C[-7],ROW(RC[-7]:R[" & ilastrow & "]C[-7])-MIN(ROW(RC[-7]:R[" & ilastrow & "]C[-7])),,1)),--(RC[-7]:R[" & ilastrow & "]C[-7]>=0)))-1"
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ 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