![]() |
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. |
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. |
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. |
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. |
All times are GMT +1. The time now is 02:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com