I have a problem comparing two ranges. For simplicity I will take two simple ranges M6:M10
and M6:M8
, I want to know if the second one is included into the first one and the first thing I though is to write
Sub example()
Dim range1, range2, inte As range
Set range1 = range("M6:M10")
Set range2 = range("M6:M8")
Set intersec = Intersect(range1, range2)
If intersec = range2 Then
[if statement]
End If
End Sub
But this procedure returns me the following error:
PRB: Error 13 (Type Mismatch) & Error 3061 w/ SQL Queries
So maybe I can't use the method "intersect" in this way...any hint on how to test range's inclusion? Thank you very much!