Microsoft Office Tutorials and References
In Depth Information
Working with Ranges
Figure 11-10: New rows were added, according to the value in column B.
Determining whether a range is contained in another range
The following InRange function accepts two arguments, both Range objects. The function
returns True if the first range is contained in the second range.
Function InRange(rng1, rng2) As Boolean
‘ Returns True if rng1 is a subset of rng2
InRange = False
If rng1.Parent.Parent.Name = rng2.Parent.Parent.Name Then
If rng1.Parent.Name = rng2.Parent.Name Then
If Union(rng1, rng2).Address = rng2.Address Then
InRange = True