1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| <div class="bbcode_container">
<div class="bbcode_quote">
<div class="quote_container">
<div class="bbcode_quote_container"></div>
Private Sub CommandButton1_Click()
'Déclaration variable des 2 selections dates (et conversion en format date)
Dim MaDateDeb As Date
MaDateDeb = CDate(ComboBox3.Value)
Dim MaDateFin As Date
MaDateFin = CDate(ComboBox4.Value)
Dim Ligne As Long
With Sheets("Listing")
If Me.ComboBox1.Text <> "" And Me.ComboBox2.Text <> "" And _
MaDateFin >= MaDateDeb And _
Me.ListBox1.Value <> "" And Me.ListBox2.Value <> "" _
Then
Ligne = .Cells(.Rows.Count, 2).End(xlUp).Row
For i = 0 To MaDateFin - MaDateDeb
Ligne = Ligne + 1
.Cells(Ligne, 2).Value = UCase(Me.ComboBox2.Text)
.Cells(Ligne, 3).Value = MaDateDeb + i
.Cells(Ligne, 4).Value = Me.ListBox1
.Cells(Ligne, 5).Value = Me.ListBox2
.Cells(Ligne, 6).Value = "EN ATTENTE"
.Cells(Ligne, 7).Value = UCase(Me.ComboBox1.Text)
'Si motif maternité, alors rajouter la période de maternité déjà validée
If Me.ListBox1.Value = "MATERNITÉ" Then
.Cells(Ligne, 2).Value = UCase(Me.ComboBox2.Text)
.Cells(Ligne, 3).Value = MaDateDeb + i
.Cells(Ligne, 4).Value = Me.ListBox1
.Cells(Ligne, 5).Value = "JOURNÉE"
.Cells(Ligne, 6).Value = "XXXXX"
.Cells(Ligne, 7).Value = UCase(Me.ComboBox1.Text)
End If
'Si motif listé, alors rajout la ligne pour la reprise à vérifier
If Me.ListBox1.Value = "MALADIE" _
Or Me.ListBox1.Value = "MALADIE PROFESSIONNELLE" _
Or Me.ListBox1.Value = "MATERNITÉ" _
Or Me.ListBox1.Value = "ARSM" _
Or Me.ListBox1.Value = "ACCIDENT DE TRAVAIL" Or Me.ListBox1.Value = "ACCIDENT DE TRAJET" _
Or Me.ListBox1.Value = "CONGÉ PATERNITÉ" Or Me.ListBox1.Value = "MI-TEMPS THÉRAPEUTIQUE" Then
.Cells(Ligne + 1, 2).Value = UCase(Me.ComboBox2.Text)
.Cells(Ligne + 1, 3).Value = MaDateFin + 1
.Cells(Ligne + 1, 4).Value = Me.ListBox1
.Cells(Ligne + 1, 5).Value = "REPRISE ???"
.Cells(Ligne + 1, 6).Value = "EN ATTENTE"
.Cells(Ligne + 1, 7).Value = UCase(Me.ComboBox1.Text)
End If
Next i
Else
MsgBox "Saisie invalide et non enregistrée !!!" & Chr(10) & Chr(10) & "Merci de contrôler la saisie avant l'enregistrement." _
, vbQuestion, "XXXXXXXXXX"
End If
End With
End Sub
</div>
</div>
</div> |
Partager