+ Reply to Thread
Results 1 to 3 of 3

Make cell variable when referencing it in cell function

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Make cell variable when referencing it in cell function

    Hi, this is a very simple question, but i am somewhat stumped.

    Please Login or Register  to view this content.
    Vdata here is a variable. I would like A2 to also be variable, so that when the active cell is on C3 it is referring to A3 for the formula. Wondering the best way to go about this. I was thinking maybe using RC[-2] but that hasn't been working.
    Last edited by undergraduate; 03-29-2010 at 12:11 AM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Make cell variable when referencing it in cell function

    If you want the final formula to reference column A of the cell holding the formula:

    ActiveCell.FormulaR1C1 = vData & "/" & RC1 & "_all_" & vData & ".xls"

    If you want the contents of colA of the current row to be put into the formula

    Please Login or Register  to view this content.
    Looking at the string that's being built, it looks like you are changing the cell's .Value rather than its .Formula.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Make cell variable when referencing it in cell function

    thanks so much sir, that worked very nicely

+ 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