1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Sub B_ok_Click()
Dim I As Integer
Dim Continuer As Boolean
' Contrôles
'----------
For I = 1 To 16
Controls("nombreMidi" & I).BackColor = RGB(255, 255, 255)
Controls("nombreSoir" & I).BackColor = RGB(255, 255, 255)
Next I
Continuer = True
For I = 1 To 16
If Not IsNumeric(Controls("nombreMidi" & I)) Then
Continuer = False
Controls("nombreMidi" & I).BackColor = RGB(255, 0, 0)
End If
If Not IsNumeric(Controls("nombreSoir" & I)) Then
Continuer = False
Controls("nombreSoir" & I).BackColor = RGB(255, 0, 0)
End If
Next I
If Continuer = False Then
MsgBox "Merci de saisir tous les champs !", vbCritical, "Contrôle des saisies"
Exit Sub
End If
' Transfert BD - MIDI
'--------------------
[A38].End(xlUp).Offset(1, 0).Select
With ActiveCell
.Value = Me.Date1
For I = 1 To 16
.Offset(0, I) = CDbl(Controls("nombreMidi" & I))
Next I
End With
' Transfert BD - SOIR
'--------------------
[A83].End(xlUp).Offset(1, 0).Select
With ActiveCell
.Value = Me.Date1
For I = 1 To 16
.Offset(0, I) = CDbl(Controls("nombreSoir" & I))
Next I
End With
Unload FormGestionRepas
End Sub |
Partager