+ Reply to Thread
Results 1 to 5 of 5

Explain How Specific R1C1 Formula Works

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    eugene, or
    MS-Off Ver
    Excel 2011
    Posts
    74

    Question Explain How Specific R1C1 Formula Works

    I have a bit of code that someone here helped me with a while back, and as my code has evolved, this has stopped working properly, I'm trying to figure out how exactly it works, and what it's doing... Any help is appreciated!

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Explain How Specific R1C1 Formula Works

    Both of the following are formulas referring to cell A1........

    The top one is absolute so R1C1 means row 1 column 1 and it will never change.
    Range("E1").FormulaR1C1 = "=R1C1"
    So you can copy/paste this formula anywhere on the worksheet but it will always refer to cell A1.

    The next sits in E1 and is relative.. R has no number meaning "same row".... C[-4] means 4 columns to the left of the host cell. Host being the cell containing the formula.
    Range("E1").FormulaR1C1 = "=RC[-4]"
    If you copy/paste this formula it will always refer to 4 colmns left of the host cell
    Last edited by AndyLitch; 04-03-2013 at 02:23 PM.
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    02-11-2013
    Location
    eugene, or
    MS-Off Ver
    Excel 2011
    Posts
    74

    Re: Explain How Specific R1C1 Formula Works

    I think I sort of understand, but I am still struggling to figure out exactly what is going wrong with the code I am working on... If anyone wants to take a look, I would greatly appreciate it! I attached 2 zip files, one with the data output files my code works with and one that it doesn't I also attached the PERSONAL workbook it all runs from. All three files need to be open for the macro to run properly. The code outputs the formula that is causing the issue in lines 25-26, and yes I know my code is not clean at all, this comes from trying to learn VBA while creating this project, sorry if it's confusing at all!
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Explain How Specific R1C1 Formula Works

    No problem - thoroughly familiar with the 'learning on the fly' scenario

  5. #5
    Registered User
    Join Date
    02-11-2013
    Location
    eugene, or
    MS-Off Ver
    Excel 2011
    Posts
    74

    Re: Explain How Specific R1C1 Formula Works

    Thanks! It's definitely been a struggle and would have been near impossible without the help of people here!

+ 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