+ Reply to Thread
Results 1 to 3 of 3

R1C1 Reference in Macro, Don't Understand

  1. #1
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    R1C1 Reference in Macro, Don't Understand

    I'm having trouble understanding why a macro I recorded reads the way it does (I'm using Excel 2003)
    If I am on SHEET1 in cell A1, and I record a formula "=SHEET2!R47" the macro displays as
    Please Login or Register  to view this content.
    If I am on SHEET1 in cell D6, and I record a formula "=SHEET2!R47" the macro displays as
    Please Login or Register  to view this content.
    I was expecting the R1C1 reference to Cell R47, on SHEET2, to be more like:
    R[47] (because it's the 47th Row) and C[18], because it's the 18th Column
    This is making it difficult for me to trouble shoot error. I believe it appears this way because the macro has "ActiveCell" and these are the coordinates relative to Range("XX").Select on SHEET1, albeit a different sheet.
    Question: Is there something else I can do with the macro so I don't have to translate from the Range("XX").Select ?
    Regards,
    Dan
    Real world knowledge isn't dropped from a parachute in the sky but rather acquired in tiny increments from a variety of sources including panic and curiosity.

  2. #2
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: R1C1 Reference in Macro, Don't Understand

    The R1C1 formula is relative to the cell in which it is inserted. If you want an absolute reference, then when you enter it in Excel, surround the column and row components with $ so you enter:

    =$R$47

    And in the macro code this will be recorded as:

    Please Login or Register  to view this content.
    For testing your Regular Expression patterns, try my Regular Expression Pattern Testing add-in!

    For notes on how to use it - see here.

  3. #3
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    Re: R1C1 Reference in Macro, Don't Understand

    Firefly,
    Thanks for the information!

+ 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