Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I return the name of a Range?

I have a group of cells that I have named "Test".

How can I return or retrieve the name of the range from one of the
cells (ActiveCell) in the range.

I have tried things like ActiveCell.Range.Name but this results in an
error.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How do I return the name of a Range?

You have to loop through the Names collection and find those names whose
RefersToRange property includes the ActiveCell. For example,

Dim Nm As Name
Dim ISect As Range
On Error Resume Next
For Each Nm In ThisWorkbook.Names
Set ISect = Nothing
Set ISect = Application.Intersect(ActiveCell, Nm.RefersToRange)
If Not ISect Is Nothing Then
Debug.Print "Name: " & Nm.Name & " contains the activecell."
End If
Next Nm



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"**Archie**" wrote in message
...
I have a group of cells that I have named "Test".

How can I return or retrieve the name of the range from one of the
cells (ActiveCell) in the range.

I have tried things like ActiveCell.Range.Name but this results in an
error.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return date if in range, else return blank LisaL Excel Worksheet Functions 1 July 22nd 09 03:23 PM
Return last cell in range puiuluipui Excel Discussion (Misc queries) 4 April 17th 09 01:56 PM
Return a value if variable is in a range plally Excel Discussion (Misc queries) 3 October 23rd 08 08:27 PM
Return all figures in a Range michaelp Excel Worksheet Functions 2 August 25th 06 08:09 AM
return min. of range except 0 Melissa Excel Discussion (Misc queries) 2 January 11th 06 12:14 PM


All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"