Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I get the name of a Cell

If a cell has already been named, how do I get that name returned in VBA? I
am trying to renanme each cell in a range that has already not been named.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How do I get the name of a Cell

Use the name.name property of the range, however you will get an error if
the range does not have a name, so use the the following to get the name for
say range C3......


Sub RangeName()
On Error Resume Next
MsgBox Range("C3").Name.Name
End Sub

Chip Pearson has some more at http://www.cpearson.com/excel/named.htm

--
Cheers
Nigel



"Delphin" wrote in message
...
If a cell has already been named, how do I get that name returned in VBA?

I
am trying to renanme each cell in a range that has already not been named.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I get the name of a Cell

I do not understand. If the cell was still named C3, then it needs to be
changed. If it has been named CDU3 then skip it. How do I determine this.

Here is my code so far: (which just stopped working...)

For x = 1 To 20

Worksheets(1).Application.Cells(x, 1).Names = "ABE" & x

Next x


I have 2400 cells to name and really did not want to do this individually as
there are maybe 100 that have already been named. This is becoming
irritating.


"Nigel" wrote:

Use the name.name property of the range, however you will get an error if
the range does not have a name, so use the the following to get the name for
say range C3......


Sub RangeName()
On Error Resume Next
MsgBox Range("C3").Name.Name
End Sub

Chip Pearson has some more at http://www.cpearson.com/excel/named.htm

--
Cheers
Nigel



"Delphin" wrote in message
...
If a cell has already been named, how do I get that name returned in VBA?

I
am trying to renanme each cell in a range that has already not been named.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I get the name of a Cell

It is easier to just rename them rather than check if they have a name.

For x = 1 To 20
Worksheets(1)..Cells(x, 1).Name = "ABE" & x
Next x

You don't need application and Names should be singular.

--
Regards,
Tom Ogilvy


"Delphin" wrote in message
...
I do not understand. If the cell was still named C3, then it needs to be
changed. If it has been named CDU3 then skip it. How do I determine

this.

Here is my code so far: (which just stopped working...)

For x = 1 To 20

Worksheets(1).Application.Cells(x, 1).Names = "ABE" & x

Next x


I have 2400 cells to name and really did not want to do this individually

as
there are maybe 100 that have already been named. This is becoming
irritating.


"Nigel" wrote:

Use the name.name property of the range, however you will get an error

if
the range does not have a name, so use the the following to get the name

for
say range C3......


Sub RangeName()
On Error Resume Next
MsgBox Range("C3").Name.Name
End Sub

Chip Pearson has some more at http://www.cpearson.com/excel/named.htm

--
Cheers
Nigel



"Delphin" wrote in message
...
If a cell has already been named, how do I get that name returned in

VBA?
I
am trying to renanme each cell in a range that has already not been

named.





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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
data validation to restrict input in cell based on value of cell above that cell NC Excel Programming 2 January 25th 05 07:11 AM


All times are GMT +1. The time now is 02:43 AM.

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

About Us

"It's about Microsoft Excel"