Finding Names associated with a cell

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

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.
 
Range("A1").Name.Name

will give you the name associated with A1 if it has one.
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top