Sub TestNameOfRange()
Dim nmName As name
On Error Resume Next
Set nmName = Selection.name
If nmName Is Nothing Then
MsgBox " Selection has no name"
Else
MsgBox nmName.name
End If
End Sub