Re:backcolor dans textbox conditions multiples
Salut Charly,
C'est fou quand on à la tête dans le guidon l'explication parait limpide, et après une réponse, je m'aperçois que c'est pas super clair.
Pour être clair et limpide :
J'ai un userform avec 3 texbox, dont la couleur initiale est rouge (saisie interdite), lorque la saisie est autorisée elle passe au blanc en respectant les conditions du menu déroulant, qui renvoi un npmbre dans une cellule ce qui donne :
La cellule est Sheets(1).Range('G28')
= 30 = textbox1 + texbox3 blanc, textbox2 rouge
=31 = textbox1 + textbox2 blanc, texbox3 rouge
= 32 = textbox2 blanc, textbox1 + texbox3 rouge
=33 = textbox2+ texbox3 blanc, textbox1 rouge
Les autres valeurs n'appellent pas le USF
En espérant avoir été plus clair
Mon souci, malgré le bon numéro les variations de couleurs ne sont pas dans le bon ordre et je pense que c'est du à la mulmtiplication des conditions.
Je te livre le code lié au menu déroulant:
Sub multiprestations()
'appelle du USF'
If Range('K11') >= 3 Then
If Range('G28') <> 31 Then Range('E28') = Range('G28')
If Range('G28') >= 30 Then
If Range('G28') <= 33 Then multiprest.Show
With Me
'fond JE'
multiprest.TextBox1.BackColor = &HFF&
If sheets(1).Range('G28').Value = 30 Then multiprest.TextBox1.BackColor = &HFFFFFF
If sheets(1).Range('G28').Value = 31 Then multiprest.TextBox1.BackColor = &HFFFFFF
'Fond loc salle journée'
multiprest.TextBox2.BackColor = &HFF&
If sheets(1).Range('G28').Value = 31 Then multiprest.TextBox2.BackColor = &HFFFFFF
If sheets(1).Range('G28').Value = 32 Then multiprest.TextBox2.BackColor = &HFFFFFF
If sheets(1).Range('G28').Value = 33 Then multiprest.TextBox2.BackColor = &HFFFFFF
'Fond loc salle 1/2 journée'
multiprest.TextBox3.BackColor = &HFF&
If sheets(1).Range('G28').Value = 30 Then multiprest.TextBox3.BackColor = &HFFFFFF
If sheets(1).Range('G28').Value = 33 Then multiprest.TextBox3.BackColor = &HFFFFFF
End With
End If
End If
End Sub
Merci du coup de main
a++
Yvon
|