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 58 59 60 61 62 63 64 65
|
Sub gerere()
Dim resultat As String
Dim deb As Integer
Dim plage As Range
Dim tmp() As String, tmr() As String
Dim erreur As Boolean
For deb = 7 To 102 Step 2
resultat = InputBox("Donner le nom", "Gestion")
If resultat = "" Then Exit For 'Si la valeur est différente de "" on affiche le résultat
Range("A" & deb).Value = resultat
heureSaisie = InputBox("Donner le début de l'heure au format xx:xx", "heure")
' Vérifiaction de la validitée
If Len(heureSaisie) Then tmp = Split(heureSaisie, ":")
' Présence de deux ; les valeurs sont numériques
If UBound(tmp) = 2 Then erreur = Not (IsNumeric(tmp(0)) And IsNumeric(tmp(1)))
heureSaisi = InputBox("Donner la fin de l'heure au format xx:xx", "heure")
' Vérifiaction de la validitée
If Len(heureSaisi) Then tmr = Split(heureSaisi, ":")
' Présence de deux ; les valeurs sont numériques
If UBound(tmr) = 2 Then erreur = Not (IsNumeric(tmr(0)) And IsNumeric(tmr(1)))
If tmp(0) = 5 And tmp(1) = 30 Then
If tmr(0) = 8 And tmr(1) = 30 Then Call coloriage(Range("B" & deb, "G" & deb), 50)
If tmr(0) = 9 And tmr(1) = 0 Then Call coloriage(Range("B" & deb, "H" & deb), 50)
If tmr(0) = 9 And tmr(1) = 30 Then Call coloriage(Range("B" & deb, "I" & deb), 50)
If tmr(0) = 10 And tmr(1) = 0 Then Call coloriage(Range("B" & deb, "J" & deb), 50)
If tmr(0) = 10 And tmr(1) = 30 Then Call coloriage(Range("B" & deb, "K" & deb), 50)
'''''''''A vérifier, Lignes manquantes
If tmp(0) = 5 And tmp(1) = 30 And tmr(0) = 11 And tmr(1) = 0 Then Call coloriage(Range("B" & deb, "L" & deb), 50)
''''''''''''''''''''''''''''''''''''''
End If
If tmp(0) = 12 And tmp(1) = 30 And tmr(0) = 20 Then
If tmr(1) = 30 Then
Call coloriage(Range("P" & deb), 50)
Call coloriage(Range("Q" & deb, "AE" & deb), 4)
End If
If tmr(1) = 45 Then
Call coloriage(Range("P" & deb), 50)
Call coloriage(Range("Q" & deb, "AF" & deb), 4)
End If
End If
Call ge 'du coup je veux appeler l'autre bouton "apres midi" qui ressemble à la
Range("A" & deb).Value = Range("A" & deb).Value + Incr
deb = deb + 2
Next deb
End Sub
Private Sub coloriage(rng As Range, couleur As Integer)
rng.Interior.ColorIndex = couleur
End Sub |