Private Sub cmdadd_Click()
Dim reference As String
Dim description As String
Dim subprocess As String
Dim transportmode As String
Dim legs As String
Dim family As String
Dim phase As String
Dim eventtype As String
Dim site As String
Dim dates As Date
reference = txtreference.Value
description = txtdescription.Value
subprocess = cmboxsubprocess.Value
transportmode = cmboxtransportmode.Value
legs = cmboxlegs.Value
family = cmboxfamily.Value
phase = Cmbfase.Value
eventtype = Cmboxeventtype.Value
site = Cmboxsite.Value
dates = DTPicker1.Value
oversize = optoversize.Value
logistique = optlogistique.Value
If oversize = "True" Then
hojadestino = "Oversize"
ElseIf logistique = "True" Then
hojadestino = "Logistic"
End If
With Sheets(hojadestino)
With .Range("A" & .Rows.Count).End(xlUp).Offset(1)
If oversize = "True" Then
.Resize(, 8).Value = Array(dates, description, subprocess, transportmode, lefs, family, phase)
ElseIf logistique = "True" Then
.Resize(, 8).Value = Array(dates, reference, description, subprocess, family, phase, eventype, site)
End If
End With
'Tri par date
.Range("A2").CurrentRegion.Sort key1:=plg.Cells(2, 1), order1:=xlAscending, Header:=xlYes
End With
End Sub