Salut starwaso,
Salut Steelson,
Un truc qui m'échappe : les cellules "vides" de tes tableaux de 20 données... ne sont pas vides et pourtant, je n'y vois rien!
Je ne sais pas comment régler ce mystère sauf à y faire attention lors de la confection de tes tableaux.
Si quelqu'un peut m'expliquer, je suis toute ouïe!
Pour fonctionner correctement, et si tu ajoutes d'autres tableaux, continue à respecter la structure actuelle (3 lignes d'écart), la base des calculs étant un modulo 25.
Private Sub Worksheet_Change(ByVal Target As Range)
'
Dim iTRow%, iRow1%, iRow2%, iIdx%, iNb%
'
Application.EnableEvents = False
Application.ScreenUpdating = False
'
If Not Intersect(Target, Range("N:N")) Is Nothing Then
iTRow = Target.Row
iRow1 = iTRow - IIf(iTRow Mod 25 = 0, 19, ((iTRow Mod 25) - 6))
iRow2 = Range("N" & iRow1 + 20).End(xlUp).Row
If iRow2 >= iRow1 + 7 Then
iNb = (iRow2 + 1) - iRow1
iIdx = IIf(iNb Mod 2 = 0, IIf(iNb < 20, CInt((iNb - 2) / 2), 8), CInt((iNb - 3) / 2))
Range("AAA1:AAA20").Value = 1
Range("AAA1:AAA20").DataSeries Type:=xlChronological, Date:=xlDay
Range("AAB1").Resize(iNb, 1).Value = Range("N" & iRow1).Resize(iNb, 1).Value
Range("AAA1:AAB" & iNb).Sort key1:=Range("AAB1"), order1:=xlAscending, Orientation:=xlTopToBottom
For x = 1 To 20
Cells((iRow1 - 1) + CInt(Range("AAA" & x).Value), 14).Interior.Color = IIf(x <= iIdx, RGB(0, 180, 240), IIf(x > iNb - iIdx And x <= iNb, RGB(0, 110, 190), RGB(255, 255, 255)))
Next
Range("AAA1:AAB20").Delete shift:=xlToLeft
Else
Range("N" & iRow1).Resize(10, 1).Interior.Color = RGB(255, 255, 255)
End If
End If
'
Application.ScreenUpdating = True
Application.EnableEvents = True
'
End Sub
A+