ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activecell - Probably very easy question (https://www.excelbanter.com/excel-programming/331134-activecell-probably-very-easy-question.html)

MattShoreson[_19_]

Activecell - Probably very easy question
 

I have a Worksheet_Change event.

In vba how can I find out the name of the range the changed cell is
in?

For the life of me I cant work out how to get it!


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=377047


Tom Ogilvy

Activecell - Probably very easy question
 
Dim nm as Name, rng as Range
for each nm in thisworkbook.Names
on Error Resume Next
set rng = nm.RefersToRange
on Error goto 0
if not rng is nothing then
if rng.parent = Target.Parent then
if not intersect(rng, target) is nothing then
msgbox "Member of " & nm & ", " & rng.Address(external:=True)
' either use "exit for" or continue to loop to see if it
' is in more than one named range
end if
end if
end if
Next

--
Regards,
Tom Ogilvy


"MattShoreson"
wrote in message
news:MattShoreson.1q9eui_1118153134.0004@excelforu m-nospam.com...

I have a Worksheet_Change event.

In vba how can I find out the name of the range the changed cell is
in?

For the life of me I cant work out how to get it!


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile:

http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=377047





All times are GMT +1. The time now is 07:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com