oldyork90 presented the following explanation :
x2010
I named a cell 'homecell' (Formulas-Define Name-Name = "homecell")
That cell is selected. The homecell name appears in Name box.
Shouldn't the following vba line then give me "homecell"? --
Application.Selection.Name
It gives me "=Sheet3!$A$1"
Thank you
Selection returns a 'fully absolute' address of the selected cells. If
you want to get the defined name you'll need to loop the names
collection for a matching absolute address. (This won't work if the
address has any 'relative' refs)
Example1: (uses Intersect function)
If Intersect(Selection, Range("homecell") Then "True" Else "False"
Example2: (compare address)
Select Case Selection.Address
Case Range("homecell").Address: "True"
Case Else: "False"
End Select 'Case Selection.Address
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion