Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Why is c not a valid name?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary''s Student - 20 Feb 2006 17:30 GMT
I am trying to assign Named Ranges as follows:

Sub Macro2()
   Range("A1").Select
   ActiveWorkbook.Names.Add Name:="a", RefersToR1C1:="=Sheet2!R1C1"
   Range("B1").Select
   ActiveWorkbook.Names.Add Name:="b", RefersToR1C1:="=Sheet2!R1C2"
   Range("C1").Select
   ActiveWorkbook.Names.Add Name:="c", RefersToR1C1:="=Sheet2!R1C3"
End Sub

The last line of code raises a 1004 That name is not valid.

Why?
Signature

Gary''s Student

Charlie - 20 Feb 2006 17:58 GMT
You're right, I didn't know that.  When I select a cell or range on a
worksheet, then ckick in the name reference box and type in "c" Excel selects
the entire column of the active cell, rather than adds a named range "c".  
Using the Insert->Name->Define menu option gives me that same error message
you got.

I guess you'll just have to use more descriptive names.

> I am trying to assign Named Ranges as follows:
>
[quoted text clipped - 10 lines]
>
> Why?
Bob Phillips - 20 Feb 2006 18:07 GMT
Which would suggest that c refers to the column would it not? In the same
way  you cannot use r, must be something to do with R1C1.

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> You're right, I didn't know that.  When I select a cell or range on a
> worksheet, then ckick in the name reference box and type in "c" Excel selects
[quoted text clipped - 18 lines]
> >
> > Why?
Tom Ogilvy - 20 Feb 2006 18:19 GMT
You can't use any name that  looks like a cell reference.

Signature

Regards,
Tom Ogilvy

> Which would suggest that c refers to the column would it not? In the same
> way  you cannot use r, must be something to do with R1C1.
[quoted text clipped - 23 lines]
> > >
> > > Why?
Bob Phillips - 20 Feb 2006 18:26 GMT
But c doesn't look like a 'cell' reference, otherwise any letter would fail.

Signature

HTH

Bob Phillips

(remove nothere from email address if mailing direct)

> You can't use any name that  looks like a cell reference.
>
[quoted text clipped - 26 lines]
> > > >
> > > > Why?
Tom Ogilvy - 20 Feb 2006 18:41 GMT
Sure it does, you said it yourself.  It does in R1C1.   Names of Names don't
change with your choice of cell addressing.

C means current column.  R means current row.

Signature

Regards,
Tom Ogilvy

> But c doesn't look like a 'cell' reference, otherwise any letter would fail.
>
[quoted text clipped - 29 lines]
> > > > >
> > > > > Why?
Charlie - 20 Feb 2006 18:21 GMT
How true!  using "r" selected the row.

> Which would suggest that c refers to the column would it not? In the same
> way  you cannot use r, must be something to do with R1C1.
[quoted text clipped - 23 lines]
> > >
> > > Why?
ben - 20 Feb 2006 18:11 GMT
that is because technically the name 'c' is already taken
just like you can not name a range 'A1', 'B1' etc
C is assigned to the entire column c as the named range 'C' therefore that
name is already assigned.

Signature

When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?

> You're right, I didn't know that.  When I select a cell or range on a
> worksheet, then ckick in the name reference box and type in "c" Excel selects
[quoted text clipped - 18 lines]
> >
> > Why?
Gary''s Student - 20 Feb 2006 18:20 GMT
Thank you all very much.

I guess I won't ask why
Dim to as String
fails when
Dim too as String
works.
Signature

Gary's Student

> that is because technically the name 'c' is already taken
> just like you can not name a range 'A1', 'B1' etc
[quoted text clipped - 23 lines]
> > >
> > > Why?
Charlie - 20 Feb 2006 18:27 GMT
Yes, that would be asking "to" much :)  "To" is a reserved keyword "For i = 1
To 10"

> Thank you all very much.
>
[quoted text clipped - 31 lines]
> > > >
> > > > Why?
Eric White - 20 Feb 2006 18:20 GMT
Excel must reserve "c" and "r" for the R1C1 notation style, though I must
admit that I've never seen that rule in any Excel book I've read.  The
closest thing I found was in the help files, where it says "Names cannot be
the same as a cell reference, such as Z$100 or R1C1."  In that vein, "R"
would refer to the entire row of the active cell and "C" the entire active
cell column.

> You're right, I didn't know that.  When I select a cell or range on a
> worksheet, then ckick in the name reference box and type in "c" Excel selects
[quoted text clipped - 18 lines]
> >
> > Why?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.