Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Why is c not a valid name?

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?
--
Gary''s Student
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Why is c not a valid name?

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.

"Gary''s Student" wrote:

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?
--
Gary''s Student

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Why is c not a valid name?

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.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Charlie" wrote in message
...
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.

"Gary''s Student" wrote:

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?
--
Gary''s Student



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why is c not a valid name?

You can't use any name that looks like a cell reference.


--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
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.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Charlie" wrote in message
...
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.

"Gary''s Student" wrote:

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?
--
Gary''s Student





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Why is c not a valid name?

But c doesn't look like a 'cell' reference, otherwise any letter would fail.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
You can't use any name that looks like a cell reference.


--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
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.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Charlie" wrote in message
...
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.

"Gary''s Student" wrote:

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?
--
Gary''s Student









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why is c not a valid name?

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.


--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...
But c doesn't look like a 'cell' reference, otherwise any letter would

fail.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tom Ogilvy" wrote in message
...
You can't use any name that looks like a cell reference.


--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
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.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Charlie" wrote in message
...
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.

"Gary''s Student" wrote:

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?
--
Gary''s Student








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Why is c not a valid name?

How true! using "r" selected the row.

"Bob Phillips" wrote:

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.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Charlie" wrote in message
...
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.

"Gary''s Student" wrote:

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?
--
Gary''s Student




  #8   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 67
Default Why is c not a valid name?

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.

--
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?


"Charlie" wrote:

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.

"Gary''s Student" wrote:

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?
--
Gary''s Student

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Why is c not a valid name?

Thank you all very much.

I guess I won't ask why
Dim to as String
fails when
Dim too as String
works.
--
Gary's Student


"ben" wrote:

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.

--
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?


"Charlie" wrote:

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.

"Gary''s Student" wrote:

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?
--
Gary''s Student

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Why is c not a valid name?

Yes, that would be asking "to" much :) "To" is a reserved keyword "For i = 1
To 10"

"Gary''s Student" wrote:

Thank you all very much.

I guess I won't ask why
Dim to as String
fails when
Dim too as String
works.
--
Gary's Student


"ben" wrote:

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.

--
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?


"Charlie" wrote:

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.

"Gary''s Student" wrote:

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?
--
Gary''s Student



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Why is c not a valid name?

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.

"Charlie" wrote:

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.

"Gary''s Student" wrote:

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?
--
Gary''s Student

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do - B2 is only valid if B1 is zero declaire9 Excel Discussion (Misc queries) 1 April 13th 10 06:45 PM
'reference is not valid' Tim Excel Discussion (Misc queries) 12 June 21st 06 07:36 PM
Reference is not valid Steved Excel Worksheet Functions 1 January 30th 06 10:56 PM
Not a valid add-in file??? keithb Excel Programming 2 September 14th 05 03:21 PM
Not A Valid Add-In [email protected] Excel Programming 3 November 3rd 04 04:59 PM


All times are GMT +1. The time now is 10:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"