on Click of a Shape

Avatar

Board Regular
Joined
Sep 20, 2005
Messages
193
Greetings,

I've run into a small problem with shapes..

Overview:
I have an excel workbook that copies rows from one sheet to put into another sheet. The originating rows have 1 shape attached. On click of this shape, i want to to identify the row it is on, and delete it.

The Problem:
I've found no way to identify the row the shape is on, or even the name of the shape. On click of the shape, it runs a macro. Since the image can be replicated 50 or more times, i have linked the original to 1 macro, which means all subsiquent copies of the shape, calls the same macro - hense the need to identify the row.

What i want, is to be able to identify the row that the shape is on, so i can identify which row to delete.

Any ideas??
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It might be better to just paste text rather than all of a copy.

This will give you the two corner addresses.
Code:
Sub myShapes()
  Dim ashp As Shape
  For Each ashp In ActiveSheet.Shapes
    MsgBox ashp.BottomRightCell.Address
    MsgBox ashp.TopLeftCell.Address
  Next ashp
End Sub
 
Upvote 0
If they are all using the same macro, then something like:
Code:
Sub DeleteRow()
  Dim shp As Shape
  set shp = Activesheet.shapes(application.caller)
  shp.topleftcell.entirerow.delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,326
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top