View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Leo Heuser[_3_] Leo Heuser[_3_] is offline
external usenet poster
 
Posts: 109
Default How to get name of named range where activecell is

You're right. I "forgot" a line with
On Error Resume Next

Thanks!

LeoH


"keepITcool" skrev i en meddelelse
.com...
Leo,

your code will produce unhandled errors if book contains names with
either constants or formulas

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Leo Heuser wrote :

Tetsuya

One way:

Sub GetName()
'Leo Heuser April 8, 2005
Dim Nam As Name

For Each Nam In ActiveWorkbook.Names
If Not Intersect(ActiveCell, Range(Nam.RefersTo)) Is Nothing
Then MsgBox Nam.Name
End If
Next Nam

End Sub