ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting the named cell (https://www.excelbanter.com/excel-programming/409028-getting-named-cell.html)

greg

getting the named cell
 
If I want to get the named cell,
For instance D5 is mycell1
If I have
Dim objRange As Excel.Range
Set objRange = Range("D5")

Can I get the name of the cell?

If I do this:
objRange.ListNames
it puts the name of the cell in the text area. Quite strange.
But, any way to get the named cell?
thanks



Peter T

getting the named cell
 
sNm = objRange.Name.Name

You'll probably want to do that under an error handler in case the range is
not named.

Regards,
Peter T

"greg" wrote in message
...
If I want to get the named cell,
For instance D5 is mycell1
If I have
Dim objRange As Excel.Range
Set objRange = Range("D5")

Can I get the name of the cell?

If I do this:
objRange.ListNames
it puts the name of the cell in the text area. Quite strange.
But, any way to get the named cell?
thanks





greg

getting the named cell
 
thanks. it works.
name.name is kinda strange

"Peter T" <peter_t@discussions wrote in message
...
sNm = objRange.Name.Name

You'll probably want to do that under an error handler in case the range
is
not named.

Regards,
Peter T

"greg" wrote in message
...
If I want to get the named cell,
For instance D5 is mycell1
If I have
Dim objRange As Excel.Range
Set objRange = Range("D5")

Can I get the name of the cell?

If I do this:
objRange.ListNames
it puts the name of the cell in the text area. Quite strange.
But, any way to get the named cell?
thanks








All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com