Private Sub CheckBox1_Click()
Dim Ligne As Long
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox2.List(Me.ComboBox2.ListIndex, 1)
If CheckBox1.Value = True Then Range("M" & Ligne).Value = CheckBox1.Caption
End Sub
Private Sub CheckBox2_Click()
Dim Ligne As Long
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox2.List(Me.ComboBox2.ListIndex, 1)
If CheckBox2.Value = True Then Range("M" & Ligne).Value = CheckBox2.Caption
End Sub
' sur le bouton Modifier, ajouter une boucle sur les checkbox 1 et 2
Private Sub CommandButton2_Click()
If MsgBox("Etes-vous certain de vouloir modifier ce produit ?", vbYesNo, "Demande de confirmation") = vbYes Then
Dim Ligne As Long
Dim I As Integer
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox2.List(Me.ComboBox2.ListIndex, 1)
For I = 1 To 12
If Me.Controls("TextBox" & I).Visible = True Then
Ws.Cells(Ligne, I) = Me.Controls("TextBox" & I)
End If
Next I
End If
For I = 1 To 2
If Me.Controls("CheckBox" & I).Value = True Then
Ws.Cells(Ligne, "M") = Me.Controls("CheckBox" & I).Caption
Else
Ws.Cells(Ligne, "M") = ""
End If
Next I
End Sub