Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
len len is offline
external usenet poster
 
Posts: 53
Default find range name for active cell

I need to determine the name of the range for the active cell on a worksheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default find range name for active cell

if the name refers to that single cell alone

msgbox activecell.name.name

if it could be part of a larger named range

for each nm in ThisWorkbook.Names
set rng = Nothing
on Error Resume Next
set rng = nm.RefersToRange
On error goto 0
if not rng is nothing then
if rng.Parent.name = activeCell.parent.Name then
set rng1 = Intersect(rng,ActiveCell)
if not rng1 is nothing them
msgbox nm.Name
exit for
end if
end if
End if
Next

--
Regards,
Tom Ogilvy

"Len" wrote in message
...
I need to determine the name of the range for the active cell on a

worksheet.


  #3   Report Post  
Posted to microsoft.public.excel.programming
len len is offline
external usenet poster
 
Posts: 53
Default find range name for active cell

Now that I have the name, how do I refer to that range? For example, if I
want to clear the range.

"Tom Ogilvy" wrote:

if the name refers to that single cell alone

msgbox activecell.name.name

if it could be part of a larger named range

for each nm in ThisWorkbook.Names
set rng = Nothing
on Error Resume Next
set rng = nm.RefersToRange
On error goto 0
if not rng is nothing then
if rng.Parent.name = activeCell.parent.Name then
set rng1 = Intersect(rng,ActiveCell)
if not rng1 is nothing them
msgbox nm.Name
exit for
end if
end if
End if
Next

--
Regards,
Tom Ogilvy

"Len" wrote in message
...
I need to determine the name of the range for the active cell on a

worksheet.



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
Find address of active cell Dave Excel Worksheet Functions 5 September 6th 06 06:43 PM
copy active cell value,find the pasted value in different worksheet [email protected] Excel Worksheet Functions 2 July 9th 06 09:56 AM
find text in a cell and make cell 2 cells below that active shark102 Excel Programming 4 October 20th 05 02:41 PM
how do find out the column of the active cell in a macro? Neill Lee Excel Programming 4 April 20th 05 09:45 PM
Find active cell Thomas[_13_] Excel Programming 5 February 18th 04 04:34 PM


All times are GMT +1. The time now is 07:50 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"