+ Reply to Thread
Results 1 to 9 of 9

Select/Delete worksheet "Text Boxes" using VBA

  1. #1
    Registered User
    Join Date
    11-09-2009
    Location
    Nevada, United States
    MS-Off Ver
    Excel 2002 - SP3
    Posts
    5

    Select/Delete worksheet "Text Boxes" using VBA

    I could use some assistance in creating a macro that will delete all and only text boxes on the active sheet. Some text boxes will be empty, but I still wish for them all to be deleted. Through searching the forums I see a similiar code, but it deletes all shapes on the active sheet:

    Please Login or Register  to view this content.


    Reference Post


    Thank you,
    Last edited by mclausell; 11-12-2009 at 12:02 PM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

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

    Hi,

    Try this?

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    11-09-2009
    Location
    Nevada, United States
    MS-Off Ver
    Excel 2002 - SP3
    Posts
    5

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

    Hi,

    I tried the above code and nothing occured. No text boxes were deleted and nor did I get any errors/debug pop up.

    I will also need to update my profile to show my current version is Excel 2002 SP3. I do plan to upgrade by the end of the month.

    Thank you for time, I am very greatful for any and all advice.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

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

    Sweep's code works fine for me, exactly as written.

    What did you do to run it?

    These are text boxes from the drawing toolbar?
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    11-09-2009
    Location
    Nevada, United States
    MS-Off Ver
    Excel 2002 - SP3
    Posts
    5

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

    Hello,

    That was a great question since I have been drawing these text boxes from the control toolbar. I will draw them from the drawing toolbar and run the code. Will post results.

    Thank you,

  6. #6
    Registered User
    Join Date
    11-09-2009
    Location
    Nevada, United States
    MS-Off Ver
    Excel 2002 - SP3
    Posts
    5

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

    Hello again,

    Yes the code works when I draw the text boxes from the drawing toolbar. Not sure if I can add more detial to my question now, but how would the code be written for removing text boxes from the control toolbar.

    Thank you,

  7. #7
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

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

    Try this..

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

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

    If they are ActiveX textboxes (as in this case) then I would use:

    Please Login or Register  to view this content.
    If they aren't ActiveX textboxes (say you added them from the Drawing toolbar) then you don't need to loop through the shapes object collection:
    Please Login or Register  to view this content.
    Hope that helps...
    Hope that helps,

    Colin

    RAD Excel Blog

  9. #9
    Registered User
    Join Date
    11-09-2009
    Location
    Nevada, United States
    MS-Off Ver
    Excel 2002 - SP3
    Posts
    5

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

    Hello everyone,

    Thank you for your help. Both codes from Sweep and Colin Legg were successful. I am very greatful of your time and efforts.

+ 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