Option Explicit
Dim dcol%
Private Sub cbjour_Change()
Dim dlg&, col%: col = cbjour.ListIndex + 2
dlg = Cells(Rows.Count, col).End(3).Row: If dlg < 3 Then Exit Sub
cbnocommercial.Clear 'on vide la liste déroulante des commerciaux
If dlg = 3 Then
cbnocommercial = Cells(3, col)
Else
cbnocommercial.List = Cells(3, col).Resize(dlg - 2).Value
cbnocommercial.ListIndex = 0
End If
'on retire les couleurs des en-têtes
With [B2].Resize(, dcol - 1)
With .Font: .ColorIndex = -4105: .Bold = 0: End With
.Interior.ColorIndex = -4142
End With
'on met une couleur de remplissage pour le jour choisi
With Cells(2, col)
With .Font: .ColorIndex = 2: .Bold = -1: End With
.Interior.ColorIndex = 32
End With
End Sub
Private Sub cbjour_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 27 Then Unload Me
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
dcol = Cells(2, Columns.Count).End(1).Column: If dcol = 1 Then Exit Sub
cbjour.List = Application.Transpose([B2].Resize(, dcol - 1).Value)
cbjour.ListIndex = 0
End Sub