Private Sub Im10_Click()
If Me.Im10.BackStyle = 0 Then
If Me.Controls("Lab" & 114).BackColor = RGB(255, 255, 50) Then
If Me.Controls("Lab" & 114).Caption = "Férié" Then
MsgBox "Attention, c'est un jour Férié, seule la vacation 3 est disponible!", vbExclamation + vbOKOnly
Call OuvPlanifAgent(1, 0, False)
End If
Else
Call OuvPlanifAgent(1, 0, True)
End If
End If
End Sub
Puis OuvPlanifAgent :
Private Sub OuvPlanifAgent(numobs As Byte, numj As Byte, total As Boolean)
Dim i As Byte
Dim Agent As String
Agent = Mid(Me.Controls("Labobs" & numobs).Caption, 3)
PlanifAgent.TboxAgent.Value = Agent
PlanifAgent.LabAAnt.Caption = Me.LabSAnt.Caption
PlanifAgent.LabAAnt.BackColor = Me.LabSAnt.BackColor
PlanifAgent.TboxDate.Value = Format(DateAdd("d", numj, Right(Me.CBoxSemaine.Value, 10)), "dddd dd/mm/yyyy")
'chargement des heures paramétrées pour cet agent
For i = 5 To 19
If ThisWorkbook.Sheets("Paramétrage").Cells(i, 3).Value = Agent Then
PlanifAgent.Tboxhburdm.Value = Format(ThisWorkbook.Sheets("Paramétrage").Cells(i, 13).Value, "hh:mm")
PlanifAgent.Tboxhburfm.Value = Format(ThisWorkbook.Sheets("Paramétrage").Cells(i, 14).Value, "hh:mm")
PlanifAgent.Tboxhburdam.Value = Format(ThisWorkbook.Sheets("Paramétrage").Cells(i, 15).Value, "hh:mm")
PlanifAgent.Tboxhburfam.Value = Format(ThisWorkbook.Sheets("Paramétrage").Cells(i, 16).Value, "hh:mm")
Exit For
End If
Next i
If total = False Then
PlanifAgent.FrVac1.Visible = False
PlanifAgent.FrVac2.Visible = False
PlanifAgent.Frbur.Visible = False
End If
PlanifAgent.Labligne.Caption = Tabligne(numobs, numj + 1)
'chargement des noms des autres agents dans les checkbox
Call PlanifAgent.AffichageAgents
PlanifAgent.Show
End Sub