Why would one populate a TextBox and then undo it?
I thought that something like Norie suggested in Post 4 would be the way to go. 1 time instead of twice.
Private Sub CommandButton1_Click()
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeName(ctrl) = "TextBox" Then
If ctrl.Value = 0 Then
ctrl.Value = ""
End If
End If
Next ctrl
End Sub
How about...
Code:Dim cCont As Control For Each cCont In Me.Controls If TypeName(cCont) = "TextBox" And cCont.Value = 0 Then cCont.Value = "" Next
Worked well (applied to activate event). How can I apply this code to every single userform that I have
Sub [B]ClearZeros[/B](UF As UserForm)
Dim cCont As Control
For Each cCont In UF.Controls
If TypeName(cCont) = "TextBox" And cCont.Value = 0 Then cCont.Value = ""
Next
End Sub
Private Sub UserForm_[COLOR=#ff0000]Activate[/COLOR]()
[I][COLOR=#000080]rest of your code.......
[/COLOR][/I]
Call [B]ClearZeros[/B](Me)
End Sub