views:

338

answers:

2

I have an many embedded objects (shapes) in a worksheet and the icons is displayed inside a cell. How do I know the Cell range in which the shape object is displayed.

for eg : When I select a Cell B2 and then select the object(shape) in the cell B17, and I query on the Cell.Address it shows B2. How will I get the cell address as B17.

thanks
-Shali

+3  A: 

You can use the Shape properties .TopLeftCell and .BottomRightCell to return the extents of the rectangular range that the shape overlaps. In your example, YourShape.TopLeftCell.Address should return $B$17

Hobbo
A: 

Supplementary question:

How do I debug if .BottomRightCell gives me an odd answer? I've got a shape that fits entirely within a cell, but when I query the BottomRightCell property, it returns a completely different cell. If the shape's in I19, BottomRightCell returns G14. If I move it to G14, it returns D11. There appears to be some kind of offset at play, but I can't work out what's going on. Any suggestions?

Jon Artus