I have a simple UserForm (Excel VBA) with one textbox, one combo box, and a command button.
When I run this code, ComboBox Type is detected with no problem, but the TextBox Type is not working, the code never gets to the [red]red[/red] portion of my code. Even tho [tt]TypeName(c)[/tt] shows [tt]TextBox[/tt].
What is going on?
---- Andy
There is a great need for a sarcasm font.
Code:
Option Explicit
Private Sub CommandButton1_Click()
Dim c As Control
For Each c In Me.Controls
Debug.Print c.Name & " is a " & TypeName(c)
If TypeOf c Is TextBox Then[red]
c.Value = ""[/red]
End If
If TypeOf c Is ComboBox Then
c.Value = ""
End If
Next c
End Sub
When I run this code, ComboBox Type is detected with no problem, but the TextBox Type is not working, the code never gets to the [red]red[/red] portion of my code. Even tho [tt]TypeName(c)[/tt] shows [tt]TextBox[/tt].
What is going on?
---- Andy
There is a great need for a sarcasm font.