+ Reply to Thread
Results 1 to 3 of 3

Macro to add count forumla with dynamic range

  1. #1
    Registered User
    Join Date
    01-17-2006
    Posts
    8

    Macro to add count forumla with dynamic range

    I am trying to use macro to add a COUNT() formula with a dynamic range.

    A small example is
    Please Login or Register  to view this content.
    But the code above does not work!


    Then I thought I can work ard iby making the ActiveCell dynamic.
    Please Login or Register  to view this content.
    But this code produce the following in the cell box in excel sheet.
    =SUM('P5':P6)
    Why does it have 'P5' insteadd of just P5


    Please advise! thanks!

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525
    Hi

    try

    "=sum(r5c:r[-1]c)"

    or

    "=sum(r" & fixedStartRow & "c:r" & dynamicRow & "c)"

    Note: Not sure if the line "fixedStartRow = 5 - Row" is working...
    If Row is a variable, change it to other name due to the vba reserved word.

  3. #3
    Registered User
    Join Date
    01-17-2006
    Posts
    8
    thanks!!!!

+ 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