Private Sub Ajout_Click()
a = IIf(Label12.Caption = "SAISIE DES FORMATIONS REALISEES", 3, 5)
With Sheets("Feuil" & a)
z = .Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
For y = 1 To 10: .Cells(z, y).Value = Controls("Te" & y).Value: Next y
For y = 1 To 5
'Début modif-----------------------------------------------------------
If Not y = 3 Then
.Cells(z, y + 10).Value = Controls("T" & y).Value
Else
.Cells(z, y + 10).Value = CDbl(Controls("T" & y).Value)
End If
'Fin modif-------------------------------------------------------------
Next y
.Cells(z, 13) = Replace(.Cells(z, 13), ",", ".") 'ligne rajoute
.Cells(z, 16) = Tb_date
.Cells(z, 17) = Tb_mois.Value
.Cells(z, 18) = Tb_semaine.Value
.Cells(z, 19) = Right(Tb_date, 4)
Cb_nomprenom = "": C1 = ""
For Each j In Controls
If TypeName(j) = "TextBox" Then j = ""
Next j
.Range("a3:s" & .Cells.Find("*", , , , , xlPrevious).Row).Sort _
Key1:=.Range("a3"), Order1:=xlAscending, Header:=xlGuess 'ligne corrige
End With
With Sheets("Feuil3")
.Range("j3:j" & .Cells(Rows.Count, "j").End(xlUp).Row).Name = "flux_réalisé"
.Range("m3:m" & .Cells(Rows.Count, "m").End(xlUp).Row).Name = "heures_réalisé"
.Range("r3:r" & .Cells(Rows.Count, "r").End(xlUp).Row).Name = "semaine_réalisé"
.Range("r3:r" & .Cells(Rows.Count, "r").End(xlUp).Row).Name = "Choix_Année_Réalisé"
End With
With Sheets("Feuil5")
.Range("j3:j" & .Cells(Rows.Count, "j").End(xlUp).Row).Name = "flux_prévision"
.Range("m3:m" & .Cells(Rows.Count, "m").End(xlUp).Row).Name = "heures_prévision"
.Range("r3:r" & .Cells(Rows.Count, "r").End(xlUp).Row).Name = "semaine_prévision"
.Range("r3:r" & .Cells(Rows.Count, "r").End(xlUp).Row).Name = "Choix_Année_Prévision"
End With
'Unload Me: Accueil.Show
End Sub 'Lors de l'activation du Userform lance la macro "est" qui permet de mettre l'affichage adapté à l'écran utilisé