Bah voici pour le code valider
Private Sub CommandButton1_Click()
Dim lig As Integer, num As Integer
With Worksheets("clients").ListObjects(1)
If .ListRows.Count = 0 Then
.ListRows.Add: lig = 1
Else: .ListRows.Add Position:=1: lig = 1 'insérer a la 1igne 1
End If
num = WorksheetFunction.Max(.ListColumns(2).DataBodyRange)
If num = 0 Then num = 1
With .DataBodyRange
.Item(lig, 1) = ComboBox5.Value
.Item(lig, 2) = num + 1
.Item(lig, 3) = Format(BoxDateD2, "dddd mmmm yyyy")
.Item(lig, 4) = ComboBox1.Value
.Item(lig, 5) = TextBox1.Value
.Item(lig, 6) = TextBox2.Value
.Item(lig, 7) = TextBox5.Value
.Item(lig, 8) = TextBox6.Value
.Item(lig, 9) = TextBox9.Value
.Item(lig, 10) = ComboBox6.Value
.Item(lig, 11) = ComboBox7.Value
.Item(lig, 12) = ComboBox2.Value
.Item(lig, 13) = ComboBox3.Value
.Item(lig, 14) = TextBox14.Value
.Item(lig, 15) = TextBox13.Value
.Item(lig, 16) = TextBox15.Value
.Item(lig, 17) = ComboBox4.Value
End With
End With
Unload Me
End Sub
Vous n'aurez plus besoin de mentionner votre numéro de facture en F1
Pensez à numéroter vos objets textbox et combo de manière progressive. Cela aide souvent à éviter trop de lignes de code
Reste d'autres choses à voir....notamment les Roswsources .... à éviter ! privilégiez les méthodes List ou Additel