Private Sub VALIDATION_Click() 'Valider l'enregistrement
Dim Wtc As Worksheet
Application.ScreenUpdating = False
Set Wtc = Sheets("TYPES BCE")
If VALIDATION.Caption = "VALIDER" Then
Dl = Wtc.Range("A" & Rows.Count).End(xlUp).Row + 1
If Dl = 2 Then
Wtc.Cells(Dl, 1).Value = 1
Else
Wtc.Cells(Dl, 1).Value = Application.WorksheetFunction.Max(Wtc.Range("A2:A" & Dl).Value) + 1
End If
Wtc.Cells(Dl, 2).Value = CDate(Me.TextBox1.Value)
Wtc.Cells(Dl, 2).NumberFormat = "m/d/yyyy"
Wtc.Cells(Dl, 3).Value = CDate(Me.TextBox2.Value)
Wtc.Cells(Dl, 3).NumberFormat = "m/d/yyyy"
Wtc.Cells(Dl, 4).Value = CDate(Me.TextBox3.Value)
Wtc.Cells(Dl, 4).NumberFormat = "m/d/yyyy"
Wtc.Cells(Dl, 5).Value = Me.ComboBox1.Value
Wtc.Cells(Dl, 6).Value = Me.ComboBox2.Value
Wtc.Cells(Dl, 7).Value = Me.ComboBox3.Value
Wtc.Cells(Dl, 8).Value = Me.TextBox4.Value
If Me.OptionButton1 = True Then Wtc.Cells(Dl, 9).Value = Me.TextBox5.Value
If Me.OptionButton2 = True Then Wtc.Cells(Dl, 10).Value = Me.TextBox5.Value
End if
End Sub