View Single Post
 
Old 12-11-2023, 08:20 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2021
Expert
 
Join Date: Apr 2014
Posts: 948
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

The following macro will list all names (because there can be more than one) that are the same position and size as the selected range (I haven't tested it on non-contiguous ranges).
If a name is sheet-scoped (as yours is) it appears with the sheet name as prefix.
Code:
Sub isdefinename()
Dim msg As String, n, zz
For Each n In Names
  Set zz = Nothing
  On Error Resume Next
  Set zz = n.RefersToRange
  On Error GoTo 0
  If Not zz Is Nothing Then
    If zz.Address(external:=True) = Selection.Address(external:=True) Then
      If msg = "" Then msg = n.Name Else msg = msg & vbLf & n.Name
    End If
  End If
Next n
If msg = "" Then msg = "Selection is not a Name"
MsgBox msg
End Sub
Reply With Quote