"That name is not valid" error

C

Chris

I'm trying to use a macro ran from a button press to set the cell name
(label) for a set of cells.

This used to work before but now I'm getting "That name is not valid"

Googling it I don't find anything that really applies to me. The name
I'm trying to set is

r3rsadobe0000161099016701040

in Row 13, Cell 5

Here is the code that performs this.

Worksheets(newEvalArr(i)).Names.Add Name:=evalName,
RefersToR1C1:=cellInR1C1

where evalName is the above text and cellInR1C1 is "=R13C5"

The workbook is not corrupted (to the best of my knowledge) and I have
successfully inserted names around that length before, so I don't know
what's up.
 
B

Bob Umlas

It begins with R and a number which Excel is interpreting as a cell
reference. It has nothing to do with VBA -- try to assign that name manually
and you get the same error. Either change the leading r to something else
(not "c"!) or have the 2nd character NOT be a number.
Bob Umlas
Excel MVP
 
C

Chris

I'm trying to use a macro ran from a button press to set the cell name
(label) for a set of cells.

This used to work before but now I'm getting "That name is not valid"

Googling it I don't find anything that really applies to me. The name
I'm trying to set is

r3rsadobe0000161099016701040

in Row 13, Cell 5

Here is the code that performs this.

Worksheets(newEvalArr(i)).Names.Add Name:=evalName,
RefersToR1C1:=cellInR1C1

where evalName is the above text and cellInR1C1 is "=R13C5"

The workbook is not corrupted (to the best of my knowledge) and I have
successfully inserted names around that length before, so I don't know
what's up.

Fixed it, I guess it was too early in the morning (or too late at
night) when I was trying to fix this originally..

Adding a preceding underscore "_" fixed the problem

so, instead of

r3rsadobe0000161099016701040

I did

_r3rsadobe0000161099016701040

and it worked perfectly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top