Private Sub Valid_Click()
Dim cel As Range, n As Byte, test As Boolean
If CB_nom.ListIndex = -1 Then _
MsgBox "Vous devez choisir le nom...", 48: CB_nom.DropDown: Exit Sub
If CB_sem.ListIndex = -1 Then
If MsgBox("Vous n'avez pas choisi les semaines, voulez-vous les effacer toutes ?", 4) = 7 _
Then CB_sem.DropDown: Exit Sub
ElseIf CB_jour.ListIndex = -1 Then _
If MsgBox("Vous n'avez pas choisi le jour, voulez-vous effacer les RTT ?", 4) = 7 _
Then CB_jour.DropDown: Exit Sub
End If
With Feuil1 'CodeName de la feuille
For Each cel In .Range("A6", .[A65536].End(xlUp))
If cel Like "Sem.*" Then
n = Replace(cel, "Sem.", "")
test = n Mod 2 = CB_sem.ListIndex Or CB_sem.ListIndex = -1
ElseIf cel = CB_nom And test Then
If CB_sem.ListIndex = -1 Or CB_jour.ListIndex = -1 Then 'effacement
Intersect(cel.EntireRow, .[B:C,F:G,J:K]).Interior.ColorIndex = xlNone
Else 'coloration
cel.Offset(, 1 + 4 * CB_jour.ListIndex).Resize(, 2).Interior.ColorIndex = 40
End If
End If
Next
End With
'Unload UF_Planning 'si l'on veut fermer l'USF
End Sub