desolé, j'avais oublier mon code VBE:
Private Sub CommandButton1_Click()
'message erreur case non remplie
If TextBox1 = "" Or TextBox2 = "" Or TextBox3 = "" Or TextBox5 = "" Or TextBox4 = "jj/mm/aaaa" Or TextBox14 = "" Then
MsgBox ("les informations: Fournisseur, Type d'achat, N° de BL, Date BL, Réf. chantier et Montant TTC sont indispensables !")
Else
'si tout est bon, remplir tableau
If Sheets("BL").Range("b4") = "" Then
Sheets("BL").Range("b4") = TextBox1
Else
'si tableau dejas remplis, creer une nouvelle ligne en bas
Sheets("BL").ListObjects(1).ListRows.Add
End If
'enregistrement sur la derniere ligne de tableau
dlt = Sheets("BL").Range("d1048576").End(xlUp).Row
'affectation case formulaire / tableau
Sheets("BL").Range("b" & dlt) = TextBox1
Sheets("BL").Range("c" & dlt) = TextBox2
Sheets("BL").Range("d" & dlt) = TextBox3
Sheets("BL").Range("e" & dlt) = TextBox4
Sheets("BL").Range("f" & dlt) = TextBox5
Sheets("BL").Range("m" & dlt) = TextBox8
Sheets("BL").Range("j" & dlt) = TextBox12
Sheets("BL").Range("k" & dlt) = TextBox13
Sheets("BL").Range("l" & dlt) = TextBox14
Sheets("BL").Range("o" & dlt) = TextBox19
Sheets("BL").Range("g" & dlt) = ComboBox1
Sheets("BL").Range("h" & dlt) = ComboBox3
Sheets("BL").Range("h" & dlt) = ComboBox4
Sheets("BL").Range("i" & dlt) = CheckBox1
Sheets("BL").Range("n" & dlt) = CheckBox2
Sheets("BL").Range("h" & dlt) = IIf(CheckBox3, "la société", "")
Unload UserForm4
End If
End Sub
Private Sub CommandButton2_Click()
'message erreur case non remplie
If TextBox1 = "" Or TextBox2 = "" Or TextBox3 = "" Or TextBox5 = "" Or TextBox4 = "jj/mm/aaaa" Or TextBox14 = "" Then
MsgBox ("les informations: Fournisseur, Type d'achat, N° de BL, Date BL, Réf. chantier et Montant TTC sont indispensables !")
Else
'si tout est bon, remplir tableau
If Sheets("BL").Range("b4") = "" Then
Sheets("BL").Range("b4") = TextBox1
Else
'si tableau dejas remplis, creer une nouvelle ligne en bas
Sheets("BL").ListObjects(1).ListRows.Add
End If
'enregistrement sur la derniere ligne de tableau
dlt = Sheets("BL").Range("d1048576").End(xlUp).Row
'affectation case formulaire / tableau
Sheets("BL").Range("b" & dlt) = TextBox1
Sheets("BL").Range("c" & dlt) = TextBox2
Sheets("BL").Range("d" & dlt) = TextBox3
Sheets("BL").Range("e" & dlt) = TextBox4
Sheets("BL").Range("f" & dlt) = TextBox5
Sheets("BL").Range("m" & dlt) = TextBox8
Sheets("BL").Range("j" & dlt) = TextBox12
Sheets("BL").Range("k" & dlt) = TextBox13
Sheets("BL").Range("l" & dlt) = TextBox14
Sheets("BL").Range("o" & dlt) = TextBox19
Sheets("BL").Range("g" & dlt) = ComboBox1
Sheets("BL").Range("h" & dlt) = ComboBox3
Sheets("BL").Range("h" & dlt) = ComboBox4
Sheets("BL").Range("i" & dlt) = CheckBox1
Sheets("BL").Range("n" & dlt) = CheckBox2
Sheets("BL").Range("h" & dlt) = IIf(CheckBox3, "la société", "")
Unload Me
UserForm4.Show
End If
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
'format affiché lors d'ouverture formulaire
TextBox4.Text = "jj/mm/aaaa"
TextBox8.Text = "jj/mm/aaaa"
ComboBox3.Visible = False
ComboBox4.Visible = False
End Sub
Private Sub TextBox4_AfterUpdate()
'message erreur
On Error GoTo messagerreur
'format date
TextBox4 = Format(TextBox4, "short date")
Exit Sub
messagerreur:
MsgBox ("Le format doit être: jj/mm/aaaa !")
TextBox4 = Empty
End Sub
Private Sub TextBox4_Enter()
'supprime l'affichage format lors du clic
If TextBox4 = "jj/mm/aaaa" Then
TextBox4 = ""
End If
End Sub
Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'remet l'affichage format lors de sortie case vide
If TextBox4 = "" Then
TextBox4 = "jj/mm/aaaa"
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'commande de numero et slash uniquement
If Not ((KeyAscii > 46 And KeyAscii < 58)) Then
KeyAscii = 0
End If
End Sub
Private Sub TextBox8_AfterUpdate()
'message erreur
On Error GoTo messagerreur
'format date
TextBox8 = Format(TextBox8, "short date")
Exit Sub
messagerreur:
MsgBox ("Le format doit être: jj/mm/aaaa !")
TextBox8 = Empty
End Sub
Private Sub TextBox8_Enter()
'supprime l'affichage format lors du clic
If TextBox8 = "jj/mm/aaaa" Then
TextBox8 = ""
End If
End Sub
Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'remet l'affichage format lors de sortie case vide
If TextBox8 = "" Then
TextBox8 = "jj/mm/aaaa"
End If
End Sub
Private Sub TextBox8_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'commande de numero et slash uniquement
If Not ((KeyAscii > 46 And KeyAscii < 58)) Then
KeyAscii = 0
End If
End Sub
'condition checkbox une seule coché
Private Sub onlyOneChkB(Selectedchkb As String)
Dim cCont As Control
If Me.Controls(Selectedchkb).Value = True Then
For Each cCont In Me.Controls
If TypeName(cCont) = "CheckBox" Then
If cCont.Name <> Selectedchkb Then
cCont.Value = False
End If
End If
Next cCont
End If
End Sub
'identification checkbox à coché
Private Sub CheckBox3_Click()
onlyOneChkB (Me.CheckBox3.Name)
End Sub
'identification checkbox à coché
Private Sub CheckBox4_Click()
onlyOneChkB (Me.CheckBox4.Name)
ComboBox3.Visible = CheckBox4
End Sub
'identification checkbox à coché
Private Sub CheckBox5_Click()
onlyOneChkB (Me.CheckBox5.Name)
ComboBox4.Visible = CheckBox5
End Sub