sbRLess

You can easily combine two ranges with Union, you can get their common parts with Intersect - but if you need to get all cells which are in Range1 but not in Range2:

Please read my Disclaimer.

Function sbRLess(r1 As Range, r2 As Range) As Range
'Returns all cells in r1 which are not in r2.
'Can return a multi-range.
'Reverse("moc.liborplus.www") V0.30 PB 06-May-2020
Dim v As Variant, r As Range, r3 As Range
Dim bFirst As Boolean
Set r3 = Application.Intersect(r1, r2)
If r3 Is Nothing Then
    Set sbRLess = r1
    Exit Function
End If
bFirst = True
For Each v In r1
    If Application.Intersect(r3, v) Is Nothing Then
        If bFirst Then
            Set r = v
            bFirst = False
        Else
            Set r = Application.Union(r, v)
        End If
    End If
Next v
Set sbRLess = r
End Function

Last updated