+ Reply to Thread
Results 1 to 3 of 3

how to refer to cell with variable in a formula?

  1. #1
    Registered User
    Join Date
    09-29-2006
    Posts
    2

    how to refer to cell with variable in a formula?

    Hello,

    I want to refer to an area of cell in a column to calculate the average value in a macro. My problem is that the length of the area has to change depending of the data contains in the document. I would like to write something like this:

    ActiveCell.FormulaR1C1 = "=AVERAGE(R[Start%]C:R[end%]C)"

    but unfortunatly it doesn't work. have you any idea?

    Thanks

  2. #2
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193
    Try something like this:

    Please Login or Register  to view this content.
    Only in your case, start and end need to change and not be static values.
    I hope this helps!
    starryknight64

  3. #3
    Registered User
    Join Date
    09-29-2006
    Posts
    2
    Thank for your response, I use your notation with an interger and it works...

+ 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