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
|
Public Sub rafraichir()
'on active la feuille
Worksheets("Feuil1").Activate
'définition des limites des indices du tableau
'colonnes
imin = 4
imax = 8
'lignes
jmin = 2
jmax = 6
'coordonnées de la donnée où tu vas chercher la date
idate = 1
jdate = 5
'coordonnées de la donnée où tu vas chercher la couleur
icouleur = 1
jcouleur = 6
'mise à jour des 4 premières colonnes
For i = imin To imax - 1
'mise à jour des 5 lignes
For j = jmin To jmax
Cells(j, i) = Cells(j, i + 1)
Cells(j, i).Interior.Color = Cells(j, i + 1).Interior.Color
Next j
Next i
'mise à jour de la 5ème colonne
'première ligne : la date
Cells(jmin, imax) = Cells(jdate, idate)
'autres lignes : on commence par enlever toute la couleur...
For j = jmin To jmax
Cells(j, imax).Interior.ColorIndex = xlColorIndexNone
Next j
'...puis on colorie celle qui faut avec la couleur qui faut
s = Cells(jcouleur, icouleur)
Select Case s
Case "niveau 1"
Cells(jmin + 1, imax).Interior.Color = RGB(0, 128, 128)
Case "niveau 2"
Cells(jmin + 2, imax).Interior.Color = RGB(0, 50, 50)
Case "niveau 3"
Cells(jmin + 3, imax).Interior.Color = RGB(0, 90, 0)
Case "niveau 4"
Cells(jmin + 4, imax).Interior.Color = RGB(90, 0, 0)
End Select
End Sub |
Partager