+ Reply to Thread
Results 1 to 2 of 2

SUM function help

  1. #1
    Registered User
    Join Date
    11-02-2005
    Posts
    7

    SUM function help

    Hey guys I am trying to write a macro to calculate something.
    But I need to use variables.

    I have tried:

    ActiveCell.FormulaR1C1 = "=SUM(R[x]C:R[y]C)"

    where x and y are integer variables but it doesn't register this.
    Does anyone know how I can do this?

  2. #2
    Dave Peterson
    Guest

    Re: SUM function help

    dim X as long
    dim Y as Long

    x = 6
    y = 7

    ActiveCell.FormulaR1C1 = "=SUM(R[" & x & "]C:R[" & y & "]C)"

    ======
    Probably better to declare x and y as longs (not integers).

    jnasr00 wrote:
    >
    > Hey guys I am trying to write a macro to calculate something.
    > But I need to use variables.
    >
    > I have tried:
    >
    > ActiveCell.FormulaR1C1 = "=SUM(R[x]C:R[y]C)"
    >
    > where x and y are integer variables but it doesn't register this.
    > Does anyone know how I can do this?
    >
    > --
    > jnasr00
    > ------------------------------------------------------------------------
    > jnasr00's Profile: http://www.excelforum.com/member.php...o&userid=28515
    > View this thread: http://www.excelforum.com/showthread...hreadid=501906


    --

    Dave Peterson

+ 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