Determining if two ranges overlap

  • Thread starter Thread starter Marky
  • Start date Start date
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
 
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)
 
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)
 
Back
Top