ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding Names associated with a cell (https://www.excelbanter.com/excel-programming/306470-finding-names-associated-cell.html)

Peter[_44_]

Finding Names associated with a cell
 
Is it possible to get the name associated with a single cell or range, or do
I have to loop through all names associated with the workbook and look for
matches?

Thanks.



Myrna Larson

Finding Names associated with a cell
 
I think you need a loop.

On Tue, 10 Aug 2004 11:47:14 +1000, "Peter"
wrote:

Is it possible to get the name associated with a single cell or range, or do
I have to loop through all names associated with the workbook and look for
matches?

Thanks.



Tom Ogilvy

Finding Names associated with a cell
 
Range("A1").Name.Name

will give you the name associated with A1 if it has one.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Is it possible to get the name associated with a single cell or range, or

do
I have to loop through all names associated with the workbook and look for
matches?

Thanks.





Myrna Larson

Finding Names associated with a cell
 
Hi, Tom:

If the range A1:D4 is named, but A1 by itself does not have a name, won't this
produce an error?

Myrna Larson

PS: Somehow (don't know why right now), I thought he meant that a given cell
was part of several named ranges. That's why I suggested a loop.


On Mon, 9 Aug 2004 22:19:29 -0400, "Tom Ogilvy" wrote:

Range("A1").Name.Name

will give you the name associated with A1 if it has one.



Tom Ogilvy

Finding Names associated with a cell
 
Perhaps I should have been clearer, but I assumed associated meant the
entire range encompassed by the named range.

Example:
? selection.Name.Name
NameA1D4
? selection.Address
$A$1:$D$4

And selecting only A1 in the above situation would raise an error. Also,
to be more general, if no name is assigned to the selected range, an error
would also be raised for Selection.Name.Name.

--
Regards,
Tom Ogilvy


"Myrna Larson" wrote in message
...
Hi, Tom:

If the range A1:D4 is named, but A1 by itself does not have a name, won't

this
produce an error?

Myrna Larson

PS: Somehow (don't know why right now), I thought he meant that a given

cell
was part of several named ranges. That's why I suggested a loop.


On Mon, 9 Aug 2004 22:19:29 -0400, "Tom Ogilvy" wrote:

Range("A1").Name.Name

will give you the name associated with A1 if it has one.






All times are GMT +1. The time now is 11:53 AM.

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