+ Reply to Thread
Results 1 to 5 of 5

Clearing text box and activex text box contents

  1. #1
    Registered User
    Join Date
    04-21-2020
    Location
    UK
    MS-Off Ver
    2010
    Posts
    4

    Question Clearing text box and activex text box contents

    Hi,

    I am new to Excel VBA and I am trying to clear the contents of a worksheet that contains both normal and activeX text boxes.
    I tried the following but it doesn't seem to work. Any guidance would be really appreciated.

    Sub TextBoxClear()
    Dim wks As Worksheet, tb As TextBox
    For Each wks In ActiveWorkbook.Worksheets
    For Each tb In wks.TextBoxes
    tb.Text = " "
    next wks
    End Sub

    Many Thanks,
    Zoe

  2. #2
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Clearing text box and activex text box contents

    Hi Zoe

    I like names with Z's in them.
    Try this..
    Please Login or Register  to view this content.
    You'll see that you need a 'Next' for every 'For' etc etc etc

    zeddy

  3. #3
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Clearing text box and activex text box contents

    Hi Zoe

    I also meant to say welcome to the Forum.

    ..and watch out for the Forum police that want you to post your sample code between proper code tags.

    zeddy

  4. #4
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: Clearing text box and activex text box contents

    Hi Zoe

    ..and joining this Forum on the Queen's birthday too!

    zeddy

  5. #5
    Registered User
    Join Date
    04-21-2020
    Location
    UK
    MS-Off Ver
    2010
    Posts
    4

    Re: Clearing text box and activex text box contents

    Hi Zeddy,

    That works great thank you. And thanks for the posting advice. Didn't realise I had joined on the Queen's birthday!
    Hope you are keeping safe and well.

    Thanks,
    Zoe

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Text appearing after some time un Text Box (ActiveX Control)
    By Shareez Saleem in forum Excel General
    Replies: 12
    Last Post: 05-10-2017, 01:12 AM
  2. Replies: 6
    Last Post: 04-21-2016, 02:15 PM
  3. [SOLVED] Macro which clears contents below X text until it encounters Y text
    By SF1eagles in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-04-2014, 04:16 PM
  4. Replies: 0
    Last Post: 11-16-2012, 11:42 AM
  5. Code to fill ActiveX text box with value from UserForm text box
    By g8r777 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2012, 08:47 PM
  6. Replies: 9
    Last Post: 03-12-2012, 03:56 PM
  7. [SOLVED] clearing text from text boxes
    By Jae in forum Excel General
    Replies: 5
    Last Post: 08-18-2005, 05:05 PM

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