Code:
Sub InvertSelection()
Dim rBig As Range
Dim rSmall As Range
Dim cell As Range
Dim rNew As Range
Set rBig = ActiveSheet.UsedRange
If TypeName(Selection) = "Range" Then
Set rBig = Selection.Parent.UsedRange
Set rSmall = Selection
End If
If Not rSmall Is Nothing Then
For Each cell In rBig.Cells
If Intersect(cell, rSmall) Is Nothing Then
If rNew Is Nothing Then
Set rNew = cell
Else
Set rNew = Union(rNew, cell)
End If
End If
Next cell
End If
If Not rNew Is Nothing ThenrNew.Select
End If
End Sub
Comments