Private Sub ListBoxcp_Click()
Set WshR = ThisWorkbook.Worksheets("Retour formulaire demande cp")
With Me.ListBoxcp
idx = .ListIndex
Ligne = .List(idx, 10)
End With
With WshR.[t_formulaire_1]
Me.[B11].Value = .Cells(Ligne, 2) 'Nom
Me.[E11].Value = .Cells(Ligne, 3) 'Prénom
Me.[D15].Value = .Cells(Ligne, 5) 'Date de la demande
Me.[C31].Value = .Cells(Ligne, 8) 'Date de début
Me.[C33].Value = .Cells(Ligne, 9) 'Date de fin
Me.[E33].Value = .Cells(Ligne, 10) 'nb jours
Me.[D13].Value = .Cells(Ligne, 4) 'Date d'entrée dans l'entreprise
Motif = .Cells(Ligne, 6)
Me.[C27].Value = .Cells(Ligne, 7) 'Autre à préciser
End With
Select Case Motif
Case "CONGES PAYES"
Me.OptionButton1 = True
Case "RTT"
Me.OptionButton2 = True
Case "EVENEMENT FAMILIAL (à préciser et joindre justificatif)"
Me.OptionButton3 = True
Case "CONGES SANS SOLDE"
Me.OptionButton4 = True
Case "AUTRE"
Me.OptionButton5 = True
End Select
With WshR.[t_formulaire_2]
Me.[A44].Value = .Cells(Ligne, 1) 'Choix du responsable
Me.[E44].Value = .Cells(Ligne, 2) 'Nom cds
Me.[H44].Value = .Cells(Ligne, 3) 'Date cds
Me.[E46].Value = .Cells(Ligne, 4) 'Motif refus
If IsDate(.Cells(Ligne, 5)) Then Me.[F48].Value = Format(.Cells(Ligne, 5), "dd/mm/yyyy") 'du
If IsDate(.Cells(Ligne, 6)) Then Me.[H48].Value = Format(.Cells(Ligne, 6), "dd/mm/yyyy") 'au
Me.[E50].Value = .Cells(Ligne, 7) 'Signature cds
End With
Range("A1").Select
End Sub