Dim c As Control
For Each c In Me.Controls
If TypeName(c) = "TextBox" And c.Value <> "" Then c.BackColor = RGB(255, 0, 0)
Next c
Dim TB As Control
For Each TB In UserForm1.Controls
If TypeName(TB) = "TextBox" Then
If TB.Text <> "" Then
TB.BackColor = &H80FF&
End If
End If
Next
Bonjour karinette,
Un conseil pour commencer, mettre le remplissage de tes textbox dans l'évènement UserForm_Initialize plutôt que UserForm_Activate (sinon à chaque activation il se re-remplira...)
puis ajouter le code là à la fin :
Code:Dim TB As Control For Each TB In UserForm1.Controls If TypeName(TB) = "TextBox" Then If TB.Text <> "" Then TB.BackColor = &H80FF& End If End If Next
Edit : Bing, Bonjour Pierrot