Names Overlapping Selection
Public Sub NamesOverlappingSelection()
Dim Message As String
Dim aName As Name
Dim NameRange As Range
Dim aRange As Range
On Error Resume Next
For Each aName In Names
Set NameRange = Nothing
Set NameRange = Range(aName.Name)
If Not NameRange Is Nothing Then
If NameRange.Parent.Name = ActiveSheet.Name Then
Set aRange = Intersect(Selection, NameRange)
If Not aRange Is Nothing Then
Message = Message & aName.Name & vbCr
End If
End If
End If
Next aName
If Message = "" Then
Debug.Print "No Names are overlapping the selection"
Else
Debug.Print Message
End If
End Sub
Related examples in the same category