View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Detect which shape was clicked....

Hi Thief,

Try assigning ththe following macro to each of thre rectangles:

Sub TestRectangles()

Select Case Application.Caller
Case "Rectangle 1"
'Do something
MsgBox Application.Caller '<<=== Demo only
Case "Rectangle 2"
'Do something
MsgBox Application.Caller '<<=== Demo only
Case "Rectangle 3"
'Do something
MsgBox Application.Caller '<<=== Demo only
End Select

End Sub


Change the names of the rectangles to accord with your names.

Replace the 'Do something lines with your desired actions.

The MsgBox lines are purely for demo purposes; click the rectangles and
test.


---
Regards,
Norman



"Thief_" wrote in message
...
IF I have 3 autoshapes, rectangles, on a worksheet, how do I detect which
shape was clicked by the user so that I can, say, delete it or change its
properties?

Thanks.

--
|
+-- Thief_
|