+ Reply to Thread
Results 1 to 5 of 5

A1 format vs R1C1 format & portability

  1. #1
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Question A1 format vs R1C1 format & portability

    Ok, so I normally develop with Excel set to A1 format.

    I have a scenario where my VBA code checks the value of a cell, and then depending on the value the address of another cell is stored.

    I then setup some conditional formatting, and had been using that stored address as a reference.

    Perhaps clearer with some example code;

    Please Login or Register  to view this content.
    Now this works FINE when Excel is set to use A1 reference style, but if I change it to use R1C1 reference style, then the code fails when it tries to add the format condition.
    It seems that the default of Address is to return in A1 format, which then the re-assignment to the conditional formatting fails on.

    So is there any way for me to tell what format Excel is currently using, and therefore know which format I should enter formula using?

    Bizarrely I am sure I have entered Conditional Formatting formula in R1C1 format when Excel has been set to use A1 and not had a problem, but I might be wrong
    Last edited by Phil_V; 08-18-2009 at 04:50 AM.
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: A1 format vs R1C1 format & portability

    Are you sure this is a format thing and not that a quirk elsewhere in your code is asking Excel to reference column (A - 2) or (B - 2)?

    CC

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: A1 format vs R1C1 format & portability

    ...is there any way for me to tell what format Excel is currently using
    see: Application.ReferenceStyle

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: A1 format vs R1C1 format & portability

    It seems that the default of Address is to return in A1 format,
    It is, but there is the option to return R1C1 format. See Help for the Address property.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: A1 format vs R1C1 format & portability

    Thanks all

    Shg, thanks, I realised that there was a way to force 'Address' to be in one format or another, but I didn't know how to tell which format was actually required at run-time

    Thanks to DO for providing the ref. for that

+ 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