Option Explicit
Dim oControl As Control, lNumL&
Private Sub CommandValider_Click()
Worksheets("BASE").Activate
lNumL = Range("NumEnregistr").CurrentRegion.Rows.Count + Range("NumEnregistr").Row
Cells(lNumL, Range("Nom").Column) = ComboBox_posteDG.Text
Cells(lNumL, Range("Nom").Column) = ComboBox_postejour.Text
Cells(lNumL, Range("Nom").Column) = ComboBox_posteDM.Text
'Cells(lNumL, Range("Date").Column) = MonthView1
Cells(lNumL, Range("Commande").Column) = Label_nom_commande.Caption
Cells(lNumL, Range("Element").Column) = ComboBox_element.Text
'Sélection de couture ou coupe ou opérateur ou conditionnement
For Each oControl In GrPostedetravail.Controls
If Left$(LCase(oControl.Name), 3) = "opb" Then
If oControl.Value Then
Cells(lNumL, Range("PosteDeTravail").Column) = oControl.Caption
End If
End If
Next oControl
Cells(lNumL, Range("NumEnregistr").Column) = _
Application.WorksheetFunction.Max(Range(Range("NumEnregistr").Offset(1), Cells(lNumL - 1, Range("NumEnregistr").Column)))
End Sub
Private Sub UserForm_Initialize()
ComboBox_posteDG.ListIndex = -1
ComboBox_posteDM.ListIndex = -1
ComboBox_postejour.ListIndex = -1
Label_nom_commande.Caption = Sheets("RESULTATS").Range("A1")
ComboBox_element.ListIndex = -1
End Sub