Shapes from Excel RRS feed

  • Question

  • Hi guys,

    I am trying to figure out a way of getting shapes from a specific part of an Excel worksheet but can't figure out a way

    Something like get all shapes that float over cells a1,a2,a3.

    I can iterate all shapes and find their bottom left corner and compare that to my a1,a2,a3 cells but the sheets I am working with

    have numerous shapes, so performace would be an issue

    Any ideas?

    PS: Is there a better forume inside MSDN I can ask this, to get more answers, I am not sure if this is ok

    Wednesday, August 12, 2015 2:51 PM

All replies

  • Hello,

    I am going to move your question to the Excel for developer forum to see if you can get assistance there.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

    Wednesday, August 12, 2015 6:47 PM
  • I am using C# and Visual Studio for this, no VBA
    Thursday, August 13, 2015 7:31 AM
  • The approach you are using is the only way. Loop all shapes and make a virtual range of cells with each shape's TopLeftCell & BottomRightCell properties, and flag if the cell or range of cells you are testing for intersects it. If you have a very large number of shapes performance might be an issue, but a few hundred in a modern system probably barely noticeable.
    Thursday, August 13, 2015 9:11 AM