Determining if two ranges overlap

M

Marky

Hi,

I am trying to write a piece of code that will enable me to validate
two ranges to determine whether or not they overlap. I can determine
fairly easily if one is contained wholly within the other but not if
they only partially overlap. Any suggestions on how I could approach
this problem would be appreciated!

Thanks,
Mark
 
B

Bob Phillips

Marky,

Intersect will do it

If Not Intersect(rng1, rng2) Is Nothing Then
...

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

Mark,

As an aside, what is your code for determining if one is contained within
the other?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top