×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

reserved names r1_, c1_?

reserved names r1_, c1_?

reserved names r1_, c1_?

(OP)
When naming ranges, we of course can't use a single letter and number (For example a1), because that is indistuinguishable from a cell address.

So I always add an underscore after cell names like that.  Works fine most of the time: a1_, b1_, d1_, e1_, etc are fine.  a2_, b2_, d2_, e2_, etc are also fine.  

I noticed that if I try to use r1_ or c1_, I get an error message "c1_ is not a valid name" and "r1_ is not a valid name".  Likewise, excel doesn't like r2_ or c2_.

Does anyone know why these particular names are prohibited?  r and c reminds me of row and column, but I have not idea why r1_ and c1_ would be reserved.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

RE: reserved names r1_, c1_?

I haven't looked into this at all, but I suspect you have 99% answered your own question.

RE: reserved names r1_, c1_?

I have another name that is not allowed. This is a single letter, "R". Why?

RE: reserved names r1_, c1_?

R stands for Row, C stands for Column. There are two ways to address a cell; the typical A23 and also RC format.

Quote:

A1 versus RC addressing

Excel addresses can be expressed in two styles, A1 style and RC style. A1 style uses one or more letters for the column, starting at "A" (column 1) and ending at "IV" (column 256); the letters are followed by an integer for the row (1 to 65536). RC style uses "RrCc" where r is the row number and c is the column number, e.g. "R1024C251". Thus "B3" and "R3C2" can refer to the same cell.

The user can choose either style to be displayed in a workbook (the default is A1). Each style supports both absolute and relative addressing (see below).

If you are generating a formula using code, or parsing an existing formula, it is generally much simpler to use RC style. However, the conversion methods in the XLL+ classes, such as CXlRef::ToString and CXlRef::FromString, support both A1 and RC style, so you can use either style as you prefer.

Note that for Excel versions in languages other than English, the letters "R" and "C" in an RC-style address will be in the local language. For example, the English address "R1C1" will be displayed as "Z1S1" in German. See also International issues above.

To be honest, you should be giving your named ranges more intuitive names. You can prefix rng (short for Range) and name them anything you like. E.g. in macros, rngRow is perfectly acceptable, as is strRow, etc. but Row will get you into trouble as it's an existing object.

RE: reserved names r1_, c1_?

(OP)
Thanks.  That is good info.  I realize I can't use a name that is ambiguous and can be mistaken, but I thought the underscore would take care of that.

R1_ and C2_  L3_ etc are very intuitive names to me when trying to simulate a circuit which is labelled in the same manner.  I guess I'll go with Res1, Cap2, L3_.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources