View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to get a cells' range name

What version of windows (and excel) has it failed?

Leith Ross wrote:

Hello gimme_this_gimme_that,

The ActiveCell.Name.Name method doesn't work on all versions of
Windows. This method isn't as short but should work with any Windows
version.

Sub GetCellRange()

Dim Rng As Range
For N = 1 To ActiveWorkbook.Names.Count
Set Rng = ActiveWorkbook.Names(N).RefersToRange
If Intersect(ActiveCell, Rng) Is Nothing = False Then
MsgBox "Cell belongs to the Named Range " Rng.Name.Name
Else
MsgBox "Cell doesn't belong to a Named Range"
End If
Next N

End Sub

Sincerely,
Leith Ross

--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=512028


--

Dave Peterson