+ Reply to Thread
Results 1 to 5 of 5

VBA Formula with an variable absolute cell reference?

  1. #1
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    VBA Formula with an variable absolute cell reference?

    Hi,

    I have a set of columns, A, B, C, and D. I'd like to add formulas to the empty column C, and the formula would basically be =$D$6/D9-1, =$D$6/D10-1, =$D$6/D11-1. (It's a percent difference calculation.)

    The problem? This is a daily report and the value that has to be absolute may shift. So, today it might be located at the $D$6 cell, but tomorrow (in a different report with the same general layout) it may be in the $D$15 location. So, basically, "$D$6" would have to be a variable, as well as the other cell in the formula.

    Could someone lend a hand? I'm stumped.

    Formula Fill Example.xlsx
    Last edited by kestefon; 04-18-2013 at 10:32 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,572

    Re: VBA Formula with an variable absolute cell reference?

    How would anyone looking at that know it's a daily report or how many days, or which days...?
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Formula with an variable absolute cell reference?

    That's just a generic example. The idea is that the highlight "Item 2" (in this case, cell D6) may have a different rank depending on when I run the before.

    The macro I'm creating is supposed to find Item 2 and then formula fill every cell in Column C below that point. I know how to do all the other parts of the code, but I'm having trouble actually writing the formula so that it'll be dynamic.

  4. #4
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Formula with an variable absolute cell reference?

    Wait a minute: I think I was approaching this all wrong. If I actually enter a formula into a cell, it appears in Excel exactly as written, right?

    I ended up writing this, which gets the job done. Are there any ways I could simplify or improve on this?

    Please Login or Register  to view this content.
    I
    Last edited by kestefon; 04-19-2013 at 01:14 AM.

  5. #5
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: VBA Formula with an variable absolute cell reference?

    Solved! However, could someone take a look at the code I wrote above and provide some input? Are there better ways of doing this?

+ 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