+ Reply to Thread
Results 1 to 8 of 8

loop to clear textboxes and labels on userform consecutive and not consecutive

  1. #1
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    loop to clear textboxes and labels on userform consecutive and not consecutive

    Hi experts,


    I need short procedure to clear multiple textboxes and labels instead of write for all of controls empty value one by one .

    so I want adding procedure to end of my code after copy from userform .
    I have textboxes 144:150 , labels 39:44 and separated numbers not consecutive like this textboxes 1.5,7,10,15 also textboxes 18,23,28,33,38
    all of theses should clear after copy from userform .
    anybody has idea ?

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    Please see yellow banner at top of page on how to attach a sample workbook.

    Example ....

    Please Login or Register  to view this content.
    Last edited by JohnTopley; 02-07-2023 at 08:25 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    For example try with:

    PHP Code: 
    Dim mRowsitiRowtb
    mRows 
    "144:150,1,5,7,15,18,23,28"
    mRows Split(mRows",")
    For 
    Each it In mRows
      
    If InStr(it":") > 0 Then iRow Evaluate("Row(" it ")") Else iRow = Array(it)
      For 
    Each tb In iRow
        Me
    ("TextBox" tb) = ""
      
    Next
    Next 
    Last edited by beyond Excel; 02-07-2023 at 09:13 AM.
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  4. #4
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    thanks John
    I thought no need to attach my file contains many codes could cause confusion for the members , if you still want attach file I will create new file .
    your idea works but for just consecutive , what about not consecutive ,how could be, please?

  5. #5
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    thanks beyond .
    it works but also I need for labels 39:44
    I try adding as is bold but doesn't work
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    Quote Originally Posted by ABDELFATTA View Post
    thanks beyond . it works but also I need for labels 39:44 . I try adding as is bold but doesn't work
    Please Login or Register  to view this content.
    You have to do it separately:

    - First clear the textBoxes, and
    - Then clean the Label.

  7. #7
    Forum Contributor
    Join Date
    06-02-2019
    Location
    libya
    MS-Off Ver
    2010
    Posts
    734

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    sorry beyond I'm not sure what you mean .
    do you mean can't do that textbox & label in the same code? should be two code are separated for each other.

  8. #8
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: loop to clear textboxes and labels on userform consecutive and not consecutive

    .
    Obviously.
    .

+ 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] Copy consecutive data from through multiple textboxes on userform to sheet
    By abdo meghari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2023, 02:55 PM
  2. Replies: 3
    Last Post: 07-20-2022, 06:42 PM
  3. [SOLVED] Formula finds the max number of consecutive times and the Total of consecutive values
    By rayhen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-01-2021, 03:06 AM
  4. [SOLVED] Asigning consecutive textbox values to multiple consecutive cells...
    By Hovoruha Octavian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2019, 06:31 PM
  5. Consecutive months for X-axis labels
    By ncarron in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 08-17-2018, 01:42 AM
  6. Replies: 6
    Last Post: 03-23-2012, 06:03 PM
  7. Consecutive #ing of Labels
    By Desert Diva in forum Excel General
    Replies: 1
    Last Post: 07-25-2005, 07:55 PM

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