ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is a cell in a range? (https://www.excelbanter.com/excel-programming/401882-cell-range.html)

DesertCyclist

Is a cell in a range?
 
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.

sebastienm

Is a cell in a range?
 
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
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"DesertCyclist" wrote:

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.


DesertCyclist

Is a cell in a range?
 
Thanks Sebastienm. I think you meant Intersect() and not Application(). This
is great. I didn't know about this. Thanks, again!

"sebastienm" wrote:

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
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"DesertCyclist" wrote:

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.


sebastienm

Is a cell in a range?
 
Yes sorry: Application.Intersect
Xl also has an Application.Union that can also be very useful.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"DesertCyclist" wrote:

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

"sebastienm" wrote:

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
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"DesertCyclist" wrote:

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.



All times are GMT +1. The time now is 09:29 AM.

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