S
shoba
I'm looking for the most efficient way to return the first rangename
which includes the current selection. And the current selection can be
a single cell.
At the moment, I'm using this routine:
-Function GetRangename(ByVal SelRng As Range) As String
On Error Resume Next
Dim nme As name
For Each nme In ThisWorkbook.Names
If Union(Range(nme), SelRng) = Range(nme) Then
GetRangename = nme
Exit Function
End If
Next nme
End Function-
As far as I know, there's no direct VBA object that returns the first
rangename which includes the cell you selected. And if I have to return
multiple rangenames, the routine needs to go through all existing
rangenames again...
Anyone got any more efficient way?
Regards,
shoba
which includes the current selection. And the current selection can be
a single cell.
At the moment, I'm using this routine:
-Function GetRangename(ByVal SelRng As Range) As String
On Error Resume Next
Dim nme As name
For Each nme In ThisWorkbook.Names
If Union(Range(nme), SelRng) = Range(nme) Then
GetRangename = nme
Exit Function
End If
Next nme
End Function-
As far as I know, there's no direct VBA object that returns the first
rangename which includes the cell you selected. And if I have to return
multiple rangenames, the routine needs to go through all existing
rangenames again...
Anyone got any more efficient way?
Regards,
shoba