Bonjour à tous,
Voici mon problème je me suis lancé dans un tableur avec VBA et je bloque lors de la saisi d'une textbox.
J'aimerais pouvoir laisser le champ vide car il s'agit d'une date de péremption et certain produit non pas de date.
Voici le code en question et en gras la ligne qui me pose souci.
'Pour le bouton Nouveau Produit
Private Sub CommandButton1_Click()
Dim L As Integer
ActiveSheet.Unprotect
If MsgBox("Confirmez-vous l’insertion de ce nouveau Produit ?", vbYesNo, "Demande de confirmation d’ajout") = vbYes Then
L = Sheets("Feuil1").Range("a65536").End(xlUp).Row + 1 'Pour placer le nouvel enregistrement à la première ligne de tableau non vide
Range("A" & L).Value = ComboBox1
Range("B" & L).Value = ComboBox2
Range("C" & L).Value = TextBox1
Range("D" & L).Value = TextBox2
Range("D" & L).Value = CLng(TextBox2)
Range("E" & L).Value = TextBox3
Range("E" & L).Value = CLng(TextBox3)
Range("F" & L).Value = TextBox4
Range("F" & L).Value = CLng(TextBox4)
Range("G" & L).Value = CDate(Me.TextBox5)
Range("G" & L).NumberFormat = "dd/mm/yy;@"
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowSorting:=True, AllowFiltering:= _
True, AllowUsingPivotTables:=True
End If
End Sub
Merci d'avance pour votre aide