DanUK
New Member
- Joined
- Aug 27, 2008
- Messages
- 42
Hi guys,
I really hope someone out there in VBA land is able to offer me some assistance with this...even if that is to say that I can't do what I want to !!
I'm writing a some VBA code that tests to see if two non contiguous ranges overlap. I'm using the Intersect method to test for this like so:
Once I've established that I do indeed have over lapping ranges (and after a further test to ensure that the overlap range is no bigger than 1 cell...), I then want to test if the values of the two overlapping ranges are the same. I tried the following code:
Now the above code doesn't work. It is syntactically correct and the two ranges (usedRange & wordRng) can be referenced in this way BUT not using the return value of the Intersect method as this is outside of the two ranges!! Does this make sense???
Does anyone know how I can obtain the values of the overalap of the intersecting ranges??
Thanks in advance.
Dan
I really hope someone out there in VBA land is able to offer me some assistance with this...even if that is to say that I can't do what I want to !!
I'm writing a some VBA code that tests to see if two non contiguous ranges overlap. I'm using the Intersect method to test for this like so:
Code:
If Not Intersect(usedRange, wordRng) Is Nothing Then
Once I've established that I do indeed have over lapping ranges (and after a further test to ensure that the overlap range is no bigger than 1 cell...), I then want to test if the values of the two overlapping ranges are the same. I tried the following code:
Code:
strAdd = Intersect(usedRange, wordRng).Address
Debug.Print usedRange.Range(strAdd).Value, wordRng.Rang(strAdd).Value
Now the above code doesn't work. It is syntactically correct and the two ranges (usedRange & wordRng) can be referenced in this way BUT not using the return value of the Intersect method as this is outside of the two ranges!! Does this make sense???
Does anyone know how I can obtain the values of the overalap of the intersecting ranges??
Thanks in advance.
Dan