+ Reply to Thread
Results 1 to 15 of 15

loop controls in userform except one textbox

Hybrid View

  1. #1
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: loop controls in userform except one textbox

    Use the TextBox Tag Property, give the TextBox to exclude a value then this code will work
    Option Explicit
    
    Private Sub cmdAdd_Click()
    
        Dim cCont As msforms.Control
    
        For Each cCont In Me.Controls
            With cCont
                Select Case TypeName(cCont)
                Case "ComboBox": .Value = ""
                Case TypeName(cCont) = "TextBox"
                    If .Tag <> "" Then .Value = ""
                Case "Label": .Caption = ""
                End Select
            End With
        Next cCont
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  2. #2
    Registered User
    Join Date
    03-17-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: loop controls in userform except one textbox

    Hello RoyUk,

    Not sure it works that way.
    To make it clear;
    I have textboxes like; txtpercentage1, txtpercentage2, txtpercentage3...
    then i have a textbox like txttrial
    I would like to have txttrial out of that loop to be set to "".

    How can i fix this?

    Thanks
    gkisacik

+ 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