+ Reply to Thread
Results 1 to 7 of 7

Select/Delete worksheet "Text Boxes" using VBA

  1. #1
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Unhappy Select/Delete worksheet "Text Boxes" using VBA

    Hi Everyone,

    I'm sure you're all familiar with Text Boxes:

    You can add shapes and text boxes (text box: A movable, resizable container for text or graphics. Use text boxes to position several blocks of text on a page or to give text a different orientation from other text in the document.) to a worksheet by using the Drawing toolbar.
    Did you know that if you click the text box button, then click on a spreadsheet (inserting a blank text box), then click off the text box, a small blank text box will remain hidden from view on your spreadsheet? Once hidden, the only way to find it is to slowly move your cursor over the Text Box edge, and watch the cursor momentarily change shape. Did you also know that if you copy or fill down the cells behind that text box, it will make as many copies of itself as you made for the cell? Not too dis-similar from a virus.

    Imagine what would happen if you unknowingly had some of these text boxes on your main calculation sheet (200 columns by 2000 rows); one where you regularly copied formulae/cells for a period of over four years. Yes, (judging by their names e.g. "Text Box 29413") the thriving population of these invisible beasties is now in the neighbourhood of thirty thousand! The damn things are worse than fleas; and they're impairing the function of the whole workbook.

    Help! Would someone please provide a VBA macro to find, select and delete these little devils from the spreadsheet (just this one spreadsheet)?

    Cheers,
    Last edited by ConneXionLost; 04-09-2009 at 12:43 PM.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Hi

    Do you want to remove all the textboxes or just specific ones? If specific, then how do you determine what you want to remove, and what you want to keep?

    rylo

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Hi Rylo,

    I want to remove all the Text Boxes on this one sheet. There are other sheets in the book, but I don't want to disturb them.

    If it is any easier to know, these Text Boxes are all blank.

    Cheers,

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Hi

    This will remove all the shapes on the current sheet. If you have shapes other than textboxes that you want to keep, then come back again for a refinement.

    Please Login or Register  to view this content.
    rylo

  5. #5
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Thanks Rylo,

    I'll give it a run in the morning when I'm at work (that's where the spreadsheet is), then post the results.

    Cheers,

  6. #6
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Success!!!

    The code ran for a solid 10 minutes. Afterwards, the document was 5 megabytes lighter.

    Thanks Rylo!!!

  7. #7
    Registered User
    Join Date
    11-12-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    1

    Smile Re: Select/Delete worksheet "Text Boxes" using VBA

    I had this same problem and this macro worked perfectly )) THANK YOU!!!

    Quote Originally Posted by rylo View Post
    Hi

    This will remove all the shapes on the current sheet. If you have shapes other than textboxes that you want to keep, then come back again for a refinement.

    Please Login or Register  to view this content.
    rylo

  8. #8
    Registered User
    Join Date
    07-03-2014
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    0

    Re: Select/Delete worksheet "Text Boxes" using VBA

    Thanks much. Somehow I had 36,000 text boxes in a file. It's now usable again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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