Private Sub UserForm_Initialize()
y = Feuil2.Range("a" & Feuil2.Cells(Rows.Count, 1).End(3).Row)
x = Left(Feuil2.Range("a" & Feuil2.Cells(Rows.Count, 1).End(3).Row), 6)
If Len(Mid(y, 7)) = 3 Then TextBox1 = x & Format(Mid(y, 7, 3) + 1, "000")
If Len(Mid(y, 7)) = 4 Then TextBox1 = x & Format(Mid(y, 7, 4) + 1, "0000")
If Len(Mid(y, 7)) = 5 Then TextBox1 = x & Format(Mid(y, 7, 5) + 1, "00000")
End Sub
Private Sub CommandButton1_Click()
Feuil2.Range("a" & Feuil2.Cells(Rows.Count, 1).End(3).Row)(2) = TextBox1
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub