+ Reply to Thread
Results 1 to 6 of 6

Locate and delete objects

  1. #1
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Locate and delete objects

    Good morning, Gurus.

    In the attached sample workbook, (Excel 2007 format), there are hundreds, maybe thousands, of drawing objects and rectangles. They are mostly located near the top of column AC. You can't see any of them, because they are empty, or formatted to have no line and no fill, ubt if you move the cursor around in that area, it will eventually give you the option to "select" one of the objects. They appear to be stacked on top of each other.

    This bloats the worksheet terribly. I have managed to shave the size of the attached sample down to 100K, bu deleting about 200 of the objects, but if I save this balnk file as an Excel 2003 file, it is 1.3 Mb.

    I have discovered how to show what objects are on the worksheet, by selecting "Find and Select" and choosing to show the "Selection Pane". This pane shows hundreds of blank objects in the sheet. When this pane is open, however, if I try to select and delete an object, Excel locks up on me.

    Is there a way to quickly delete all objects from a worksheet?

    Thanks in advance for any help you can offer.
    Attached Files Attached Files
    Last edited by hutch@edge.net; 12-31-2009 at 01:48 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Locating and deleting objects

    This will clear all Buttons and shapes in the active worksheet.
    This happens when rows are deleted but the shapes are not, they end up getting scrunched at the top.


    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-31-2009 at 12:53 PM.

  3. #3
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Re: Locating and deleting objects

    Hi

    Try the following code

    Please Login or Register  to view this content.
    Works on your sample no problem.

    Regards

    Jeff

  4. #4
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: Locating and deleting objects

    If you don't want to use VBA you can click Find & Select in the ribbon then Go to Special, select Objects and click OK. This will select every object in the sheet so you can just press the delete key once to remove them all. With the number of objects in your file this takes a few minutes so you need to be patient!

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Locating and deleting objects

    hi Hutch,

    Yes, in the sample file there were 6706 drawing objects!

    Try running this macro...
    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Re: Locating and deleting objects

    That did it, guys. Thanks!!

    Have a Happy New Year!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1