View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych[_2_] Tim Zych[_2_] is offline
external usenet poster
 
Posts: 41
Default Cell in Range Testing Function

The Intersect Method does this:

Sub isect()
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Range("A1:D2")
Set rng2 = Range("D3")
If Not Application.Intersect(rng1, rng2) Is Nothing Then
'They intersect
MsgBox rng1.Address & " intersects " & rng2.Address
Else
MsgBox rng1.Address & " does not intersect " & rng2.Address
End If
End Sub

This works with contiguous or non-contiguous ranges.

Hth,
Tim

"Jim C." wrote in message
...
Can anyone point me to a function that will return a value base on
whether a range of cells is;
1. Located inside another specified range.
2. Intersects another specified Range.
3. Does not intersect another specified range

The function I am looking for would include the ranges in the call
arguments. If I could be so bold I would prefer that this function
support multiple areas as well ( Oh yea, now I'm asking for it.)

I could code this myself, but like the rest of us I'm lazy.

Thanks everyone,

Jim C.


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---