Private Sub Cmd_Valider_Click()
Dim xNewLig As Long
If xMaintenance <> "TER" Then
Range("AJ" & xLig) = xMaintenance
Else
With Sheets("Planning")
xMachine = .Range("B" & xLig)
xDateDeb = .Range("D" & xLig)
xDateFin = .Range("F" & xLig)
.Range("B" & xLig) = Empty
.Range("D" & xLig) = Empty
.Range("E" & xLig) = Empty
.Range("AJ" & xLig) = Empty
End With
xNewLig = [Tab_Archive].ListObject.ListRows.Add.Index 'On insere une nouvelle ligne au tableau structuré
Range("Tab_Archive[Nom machine]")(xNewLig, 1) = xMachine
Range("Tab_Archive[Début tâche]")(xNewLig, 1) = xDateDeb
Range("Tab_Archive[Fin tâche]")(xNewLig, 1) = xDateFin
End If
Unload Me
End Sub