ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel "name is not valid" when naming a cell (https://www.excelbanter.com/excel-programming/372713-excel-name-not-valid-when-naming-cell.html)

cheesey_toastie

excel "name is not valid" when naming a cell
 
I am programmatically naming cells based on a header row and their
position. The problem is not in code but in a name I am trying to use.

I am trying to name a cell 'C2a.1' and I get 'That Name is not Valid'.

When doing this manually I get the same error. Looking at the help I
know I can't name a cell or range like a valid Excel reference e.g. A2
or $A$2 or R1C2 etc... but this is a mystery to me!

Any ideas?

Steve


Dave Peterson

excel "name is not valid" when naming a cell
 
Excel doesn't even like names that even look close to an address.

And C2 could be cell C2 (in A1 reference style) or column 2 (in R1C1 reference
style).

Maybe you can just prefix your names with an undersco _C2a.1

Or something unique that you want to use.

cheesey_toastie wrote:

I am programmatically naming cells based on a header row and their
position. The problem is not in code but in a name I am trying to use.

I am trying to name a cell 'C2a.1' and I get 'That Name is not Valid'.

When doing this manually I get the same error. Looking at the help I
know I can't name a cell or range like a valid Excel reference e.g. A2
or $A$2 or R1C2 etc... but this is a mystery to me!

Any ideas?

Steve


--

Dave Peterson

Bernie Deitrick

excel "name is not valid" when naming a cell
 
Steve,

Many invalid names can become 'valid' if you use a leading undersocre "_" '_C2a.1' will work.
And it should be easy to modify your code to do it...

HTH,
Bernie
MS Excel MVP


"cheesey_toastie" wrote in message
ups.com...
I am programmatically naming cells based on a header row and their
position. The problem is not in code but in a name I am trying to use.

I am trying to name a cell 'C2a.1' and I get 'That Name is not Valid'.

When doing this manually I get the same error. Looking at the help I
know I can't name a cell or range like a valid Excel reference e.g. A2
or $A$2 or R1C2 etc... but this is a mystery to me!

Any ideas?

Steve




cheesey_toastie

excel "name is not valid" when naming a cell
 
It seems to be because it begins with a C, then a digit then a
letter...


cheesey_toastie wrote:
I am programmatically naming cells based on a header row and their
position. The problem is not in code but in a name I am trying to use.

I am trying to name a cell 'C2a.1' and I get 'That Name is not Valid'.

When doing this manually I get the same error. Looking at the help I
know I can't name a cell or range like a valid Excel reference e.g. A2
or $A$2 or R1C2 etc... but this is a mystery to me!

Any ideas?

Steve



cheesey_toastie

excel "name is not valid" when naming a cell
 
I hate Excels use of names. I am already using things like c2.1 c2.5
its just the c2a.1

I would guess its a bug in the bit of code that validates the name as
it looks close to a R1C1 style formula.

Oh well.. workaround time! Thanks for the underscore suggestion, I
had already done that as a test - it's not ideal as I am actually using
these codes in a third party system.

Thanks for the replies


cheesey_toastie wrote:
It seems to be because it begins with a C, then a digit then a
letter...


cheesey_toastie wrote:
I am programmatically naming cells based on a header row and their
position. The problem is not in code but in a name I am trying to use.

I am trying to name a cell 'C2a.1' and I get 'That Name is not Valid'.

When doing this manually I get the same error. Looking at the help I
know I can't name a cell or range like a valid Excel reference e.g. A2
or $A$2 or R1C2 etc... but this is a mystery to me!

Any ideas?

Steve




All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com