Private Sub CommandButton1_Click() 'Valider
Dim lig As Long
lig = CLng(Me.VarLigne.Caption)
If Len(Me.TextBox7.Value) > 0 And Len(Me.TextBox8.Value) > 0 And Len(Me.ComboBox2.Value) > 0 Then
Select Case Me.ComboBox2.Value
Case Is = "Affûtage"
If Len(Me.TextBox8.Value) > 0 Then Range("H" & lig).Value = Range("H" & lig).Value - Me.TextBox8.Value
Range("I" & lig).Value = CDate(Me.TextBox7.Value) 'date mouvement
Range("J" & lig).Value = CLng(Me.TextBox8.Value) 'nb mouv
Range("K" & lig).Value = Me.ComboBox2.Value 'motif mouv
Case Is = "Retour d'affûtage"
If Len(Me.TextBox8.Value) > 0 Then Range("H" & lig).Value = Range("H" & lig).Value + Me.TextBox8.Value
Case Is = "Suppression"
If Len(Me.TextBox8.Value) > 0 Then Range("H" & lig).Value = Range("H" & lig).Value - Me.TextBox8.Value
Case Is = "Nouveau"
If Len(Me.TextBox8.Value) > 0 Then Range("H" & lig).Value = Range("H" & lig).Value + Me.TextBox8.Value
End Select
Else
Range("I" & lig).ClearContents
Range("j" & lig).ClearContents
Range("K" & lig).ClearContents
End If
Range("B" & lig).Value = Me.TextBox1.Value
Range("C" & lig).Value = Me.TextBox2.Value
Range("D" & lig).Value = Me.TextBox3.Value
Range("E" & lig).Value = Me.TextBox4.Value
Range("F" & lig).Value = Me.TextBox5.Value
Range("G" & lig).Value = Me.TextBox6.Value
Range("A" & lig).Value = Me.ComboBox1.Value
Unload Me
MsgBox ("Fiche mise à jour")
End Sub