Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determining if two ranges overlap

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


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Determining if two ranges overlap

Hi
try
If Intersect(range1, range2) Is Nothing Then 'no overlapping
--
Regards
Frank Kabel
Frankfurt, Germany

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


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determining if two ranges overlap

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)

"Marky " wrote in message
...
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


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determining if two ranges overlap

Thanks guys, that worked a treat!

Mar

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determining if two ranges overlap

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)

"Marky " wrote in message
...
Thanks guys, that worked a treat!

Mark


---
Message posted from http://www.ExcelForum.com/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
overlap printing riven Excel Discussion (Misc queries) 1 May 14th 09 12:46 PM
how copy formula that contains ranges so ranges do not overlap Patty Excel Worksheet Functions 1 November 20th 08 04:15 PM
how can i networkdays date ranges where dates overlap Angelo1803 Excel Worksheet Functions 1 February 7th 08 02:55 PM
DataLabel Overlap Stan Charts and Charting in Excel 0 April 30th 07 03:40 AM
Show Overlap Erika Charts and Charting in Excel 3 October 20th 06 03:13 PM


All times are GMT +1. The time now is 07:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"