Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check if a range is inside another
Hi,
What options do I have to check if the target range of a SelectionChange event is inside another? Rafael |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check if a range is inside another
Hi Rafael
This will give you a start ;-) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Application.Intersect(Target, Range("myrng")) Is Nothing Then MsgBox "ranges intersect" Else MsgBox "Ranges Don't intersect!" End If End Sub Rafael Sobral wrote in message ... Hi, What options do I have to check if the target range of a SelectionChange event is inside another? Rafael |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check if a range is inside another
Loomah showed how to check if they intersect by at least one cell although I
would assume contain means that all cells in target are within the range of myrng . To see if target is totally contained in the range Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Application.Union(Target, Range("myrng")).Address = Range("myrng").Address Then MsgBox "Target is contained within or equal to myrng" Else MsgBox "Target not contained within or equal to myrng" End If End Sub you can use Intersect and compare the address to Target.address -- Regards, Tom Ogilvy "Rafael Sobral" wrote in message ... Hi, What options do I have to check if the target range of a SelectionChange event is inside another? Rafael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can i use countif function inside a filtered range | New Users to Excel | |||
how can I check for cell focus inside a spreadsheet ? | Excel Worksheet Functions | |||
Using a range variable inside a excel function | Excel Discussion (Misc queries) | |||
Check if a String is inside an Array | Excel Programming | |||
Check if a String is inside an Array | Excel Programming |