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) = Controls("Te" & y).Value: Next y
For y = 1 To 5: .Cells(z, y + 10) = Controls("T" & y).Value: Next y
.Cells(z, 16) = Tb_date
.Cells(z, 17) = Tb_mois.Value
.Cells(z, 18) = Tb_semaine.Value
Cb_nomprenom = "": C1 = ""
For Each j In Controls
If TypeName(j) = "TextBox" Then j = ""
Next j
.Range("a3:r" & Cells.Find("*", , , , , xlPrevious).Row).Sort _
Key1:=.Range("a3"), Order1:=xlAscending, Header:=xlGuess
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é"
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"
End With
Unload Me: Accueil.Show
End Sub