Private Sub CommandButton2_click()
Dim derligne As Integer
If MsgBox("étes vous sûr de vouloir valider?", vbYesNoCancel + vbExclamation, "demande de confirmation") = vbYes Then
With Worksheets("feuil1")
derligne = .Range("A65536").End(xlUp).Row + 1
'Verifier que la valeur entree est reconnue comme etant une date valide
If IsDate(TextBox1.Value) Then
'Ecrire une valeur de type DATE; c'est essentiel
.Cells(derligne, 1) = CDate(TextBox1.Value)
Else
MsgBox TextBox1.Text & " n'est pas une date valide", , "Date : Entree non valide"
End If
'Verifier que la valeur entree est reconnue comme etant numerique
If IsNumeric(Replace(TextBox5.Value, ".", Format(0, "."))) Then
'Ecrire une valeur de type numerique
.Cells(derligne, 6) = CDbl(Replace(TextBox5.Value, ".", Format(0, ".")))
Else
MsgBox TextBox5.Text & " n'est pas une valeur numerique", , "Total : Entree non valide"
End If
If TextBox2.Value > 0 Then .Cells(derligne, 2) = TextBox2.Value
If ComboBox1.Value > 0 Then .Cells(derligne, 3) = ComboBox1.Value
If OptionButton2.Value >= 0 Then .Cells(derligne, 4).Value = "P"
If OptionButton1.Value >= 0 Then .Cells(derligne, 5).Value = "N/P"
End With
End If
Unload UserForm1
Load UserForm1
UserForm1.Show 0
End Sub