Is a cell in a range?

D

DesertCyclist

How can I find out if the ActiveCell is one of the cells in a named range? In
the SheetChange event, I want to take an action only if the cell that was
just changed (Target parameter?) belongs to a certain named range.

Thank you.
 
S

sebastienm

Hi,
Check whether or not the Intersection of these 2 ranges is nothing or not:

If Not Application(ActiveCell, Range( "<rangename>")) Is Nothing then
''' do something
End if
 
D

DesertCyclist

Thanks Sebastienm. I think you meant Intersect() and not Application(). This
is great. I didn't know about this. Thanks, again!
 
S

sebastienm

Yes sorry: Application.Intersect
Xl also has an Application.Union that can also be very useful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top