Evelynetfrancois
XLDnaute Impliqué
BONJOUR à tous !!
Que de lignes que de lignes ....................
En fonction de la valeur de la TextBox4 je colore certain label.....
Toutes ces lignes fonctionnent parfaitement, mais je pense qu il y a beaucoup plus "propre, voir moins lourd !!!" en VBA
si vous avez une solution de rêve .... Je suis preneur
Merci pour tout
A bientôt vous lire
E et F
(Les valeurs différentes de TB4 ne sont pas une suite logique)
If TextBox4.Value = "1" Then
Label4.BackColor = &HC000&
End If
If TextBox4.Value = "2" Then
Label5.BackColor = &HC000&
End If
If TextBox4.Value = "3" Then
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "4" Then
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "5" Then
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "12" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
End If
If TextBox4.Value = "13" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "14" Then
Label4.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "15" Then
Label4.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "23" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "24" Then
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "25" Then
Label5.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "34" Then
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "35" Then
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "45" Then
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "123" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "124" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "125" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "134" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "135" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "145" Then
Label4.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "234" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "235" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "245" Then
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "345" Then
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1234" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "1235" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1245" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1345" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "2345" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "12345" Then
For I = 4 To 8
Me.Controls("Label" & I).BackColor = &HC000&
Next I
End If
Que de lignes que de lignes ....................
En fonction de la valeur de la TextBox4 je colore certain label.....
Toutes ces lignes fonctionnent parfaitement, mais je pense qu il y a beaucoup plus "propre, voir moins lourd !!!" en VBA
si vous avez une solution de rêve .... Je suis preneur
Merci pour tout
A bientôt vous lire
E et F
(Les valeurs différentes de TB4 ne sont pas une suite logique)
If TextBox4.Value = "1" Then
Label4.BackColor = &HC000&
End If
If TextBox4.Value = "2" Then
Label5.BackColor = &HC000&
End If
If TextBox4.Value = "3" Then
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "4" Then
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "5" Then
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "12" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
End If
If TextBox4.Value = "13" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "14" Then
Label4.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "15" Then
Label4.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "23" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "24" Then
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "25" Then
Label5.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "34" Then
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "35" Then
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "45" Then
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "123" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
End If
If TextBox4.Value = "124" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "125" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "134" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "135" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "145" Then
Label4.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "234" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "235" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "245" Then
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "345" Then
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1234" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
End If
If TextBox4.Value = "1235" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1245" Then
Label4.BackColor = &HC000&
Label5.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "1345" Then
Label4.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "2345" Then
Label5.BackColor = &HC000&
Label6.BackColor = &HC000&
Label7.BackColor = &HC000&
Label8.BackColor = &HC000&
End If
If TextBox4.Value = "12345" Then
For I = 4 To 8
Me.Controls("Label" & I).BackColor = &HC000&
Next I
End If