Option Explicit
Private Sub CommandButton1_Click()
Dim s As String, lr As Long, x As Long
With Worksheets("Feuil1")
lr = .Range("B" & Rows.Count).End(xlUp).Row + 1
.Cells(lr, 2).Value = TextBox1.Value
.Cells(lr, 3).Value = TextBox2.Value
.Cells(lr, 4).Value = CDate(TextBox3.Value)
If ComboBox1.Value <> "" Then
Select Case ComboBox1.Value
Case "A": s = "A"
Case "B": s = "B"
End Select
x = Application.WorksheetFunction.CountIf(.Columns(5), s) + 1
.Cells(lr, 1).Value = "'" & CStr(x) & "/20"
End If
.Cells(lr, 5).Value = ComboBox1.Value
With .Range(.Cells(lr, 1), .Cells(lr, 5))
.Borders.LineStyle = xlContinuous
End With
End With
MsgBox "Done...", 64
Call vide
End Sub
Private Sub UserForm_Initialize()
TextBox3.Text = Format(Now, "dd/mm/yyyy")
ComboBox1.List = Array("A", "B")
End Sub