Private Sub CommandButton1_Click()
With Sheets("Feuil1")
.[B3] = -CheckBox1
.[B4] = -CheckBox2
.[B5] = -CheckBox3
.[B6] = -CheckBox4
If Application.Sum(.[B3:B6]) = 0 Then MsgBox "Aïe aïe aïe..."
End With
End Sub
si les saisies sont obligatoires sans doute 1Si...
Code:
Private Sub CommandButton1_Click()
For n = 1 To 4
If Not Me("CheckBox" & n) Then
MsgBox "case(s) à contrôler !", vbInformation, "Alerte..."
Exit Sub
End If
Next
For n = 1 To 4: Cells(n + 2, 2) = n: Next 'pour un contrôle éventuel
End Sub
Private Sub CommandButton1_Click()
If CheckBox1 + CheckBox2 + CheckBox3 + CheckBox4 = 0 Then
MsgBox "Aïe aïe aïe..."
Exit Sub
End If
With Sheets("Feuil1")
.[B3] = -CheckBox1
.[B4] = -2 * CheckBox2
.[B5] = -3 * CheckBox3
.[B6] = -4 * CheckBox4
End With
End Sub