Results 1 to 15 of 15

loop controls in userform except one textbox

Threaded View

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

    loop controls in userform except one textbox

    Hello there,

    I am using a userform where i have my textboxes, comboboxes with a commandbutton.
    When i click on that commandbutton, i would like to reset all the textboxes except one of them.
    Currently i am using the following code i got from the internet. But how can I have one of my textboxes unchanged on the userform?

    Private Sub cmdAdd_Click()
    
    Dim cCont As Control
    
            For Each cCont In Me.Controls
    
                If TypeName(cCont) = "ComboBox" Then
    
                cCont.Value = ""
    
                End If
                
                If TypeName(cCont) = "TextBox" Then
                
                cCont.Value = ""
                
                End If
    
                If TypeName(cCont) = "Label" Then
    
                cCont.Value = ""
    
                End If
                
            Next cCont
    
    End Sub
    Thanks

    gkisacik
    Last edited by gkisacik; 03-28-2010 at 03:18 AM.

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