View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Get Name of Selected Range

Charlie wrote:
Good Morning,

Is there a method or property that returns the Name (if any) of a selected
or specific range? Something like:

NameOfRange = ThisWorkbook.Names.Item(Selection).Name
NameOfRange = ThisWorkbook.Names.Item(ActiveCell).Name
NameOfRange = ThisWorkbook.Names.Item(Cells(1, 1)).Name
NameOfRange = ThisWorkbook.Names.Item(Range("A1")).Name
NameOfRange = ThisWorkbook.Names.Item(Range("A1:B2")).Name

TIA
Charlie

E.g.:

Sub testIt3a()
On Error Resume Next
MsgBox Selection.Name.Name
If Err < 0 Then MsgBox "The specified range is not a named range"
End Sub

Alan Beban