Re : Création d'un numéro de référence
Bonsoir Leskwal,
Une solution de code de la macro d'initialisation de l'Userform :
Private Sub UserForm_Initialize()
Dim Derlig As Integer
With Sheets("Actions")
Derlig = .Range("A65536").End(xlUp).Row
If Derlig = 2 Then
TextBoxNumeroAuto = 1
Else
TextBoxNumeroAuto = .Cells(Derlig, 1) + 1
End If
End With
TextBox1.Value = Format(Date, "yyyy")
If Left(Format(Date, "yy"), 1) = 0 Then
TextBoxCodeAnnee = Right(Format(Date, "yy"), 1)
Else
TextBoxCodeAnnee = Format(Date, "yy")
End If
End Sub
Cordialement
Bernard