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
| Sub DonneNBannee()
Dim i As Integer, R As Integer
Dim tableau(1, 2000 To 2008) As String
Dim M As Integer
tableau(1, 2000) = "Malade"
tableau(1, 2001) = "Malade"
tableau(1, 2002) = "OK"
tableau(1, 2003) = "OK"
tableau(1, 2004) = "Malade"
tableau(1, 2005) = "Malade"
tableau(1, 2006) = "Malade"
tableau(1, 2007) = "OK"
tableau(1, 2008) = "OK"
Reco:
R = InputBox("Quelle année voulez-vous contrôllez ?", "Contrôle", Year(Now) - 1)
If R < 2001 Or R > 2008 Then
MsgBox "contrôle disponnible entre 2001 et 2008"
GoTo Reco
End If
For i = R To 2000 Step -1
If tableau(1, i) = "Malade" Then
M = M + 1
Else
Controler:
If M <> 0 Then
MsgBox "La personne est malade depuis " & M & " an(s)"
Else
MsgBox "La personne est active"
End If
Exit Sub
End If
Next i
If i < 2000 Then GoTo Controler
End Sub |
Partager