Determining whether a range is contained in another range
Function InRange(rng1, rng2) As Boolean 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 End If End If End If End Function
1. | Using the Union Method to Join Multiple Ranges | ||
2. | Use Union when you want to generate a range from two or more blocks of cells. | ||
3. | Returns True if rng1 is a subset of rng2 |