Thread: Invalid name?!?
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Invalid name?!?

I really don't care what you think and certainly don't need a lecture
on cell reference styles and defined names.

When using R1C1 reference style Excel won't accept C or R as the
prefix if followed by a number.


Gord



On Thu, 19 Apr 2012 12:06:40 -0700, "joeu2004"
wrote:

"Charlotte E." wrote:
I'm trying to add the following names to a workbook:
ActiveWorkbook.Names.Add Name:="A03_01", RefersToR1C1:=...
ActiveWorkbook.Names.Add Name:="B03_01", RefersToR1C1:=...
ActiveWorkbook.Names.Add Name:="C03_01", RefersToR1C1:=...
ActiveWorkbook.Names.Add Name:="D03_01", RefersToR1C1:=...
ActiveWorkbook.Names.Add Name:="E03_01", RefersToR1C1:=...

[....]
ActiveWorkbook.Names.Add Name:="C03_01", RefersToR1C1:=...
Fails, with a message, saying that the name is invalid?!?
Why is "C03_01" invalid, and the rest are OK?!?



"Gord Dibben" wrote:
You are using R1C1 reference style and Excel won't
accept C0 because it is interpreted as a cell reference.


I don't believe that is the right explanation.

First, read Charlotte's posting in detail. Why does "B03_01", but "C03_01"?
Why would B03_01 be any less of a cell reference than C03_01?

Second, try this manually on a new workbook (not in R1C1 mode by default).
With A1 selected, go to the Name Manager.

We can enter names like B01_03 and B03_01 just fine.

But we get a syntax error when we try to enter names like C01_03 and C03_01.

Also, we get a syntax error with the names B0103 and B0301 (no underscore).

My WAG: these are names (or forms of names) of __internal__ Excel objects,
just as the syntax error suggests. Whatever, they are obviously names that
Excel reserves.