That's not what I had in mind. I put your code into the VBA code associated
with a blank spreadsheet and added the Worksheet_SelectionChange() code on
the same sheet as follows:

Public Sub WhichShape()
Dim strSelectedShape As String
On Error GoTo NONAME
strSelectedShape = Selection.Name
MsgBox strSelectedShape
NONAME:
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox "targetaddress is " & Target.AddressLocal
End Sub

Then I placed some arrows on the sheet, to provide a shape to select.

When I select a cell, I get the message box stating its address. When I
select a line, nothing happens. Why does one work, and not the other?



"Ken Johnson" <[email protected]> wrote in message
news:[email protected]...
> Hi Ray,
> If a shape is selected then Shape.Name returns its name.
> If the selection is a named range then Shape.Name returns the RefersTo
> eg "=Sheet1!$A$1"
> If the selection is an unnamed range then an error occurs.
> So if your sheet has no named ranges you could use something like...
>
> Public Sub WhichShape()
> Dim strSelectedShape As String
> On Error GoTo NONAME
> strSelectedShape = Selection.Name
> MsgBox strSelectedShape
> NONAME:
> End Sub
>
> If there is a named range(s) on the sheet then you might have to test
> for the presence of the "=" in the string strSelectedShape...
>
> Public Sub WhichShape()
> Dim strSelectedShape As String
> On Error GoTo NONAME
> strSelectedShape = Selection.Name
> If Left(strSelectedShape, 1) <> "=" Then
> MsgBox strSelectedShape
> End If
> NONAME:
> End Sub
>
> Ken Johnson
>