Bonjour le Forum
je m'adresse à vba-new
pour une suite de ces formules en vba
ça fonctionne parfaitement pour un tableau
mais au cas ou je remet un autre tableau
4 lignes en dessous pratiquement a l'identique mais d'autre chiffres
avec la même recherche de la feuil2
merci vba-new si dispo ,et a ceux qui prendrons la main
ODE: TOUT SÉLECTIONNER
Private Sub Worksheet_Change(ByVal Target As Range)
Dim val1 As Long, val2&, taille&, col1&, lign1&
If Not Application.Intersect(Target, [e8]) Is Nothing Then
val1 = [c8]
val2 = [d8]
If val1 < val2 And val2 <= val1 + 24 Then
taille = IIf(IIf([e8] > 8, 8, [e8]) < 0, 0, IIf([e8] > 8, 8, [e8]))
With Sheets("Feuil1")
col1 = Application.WorksheetFunction.Match(val1, .[c5:bj5], 0)
lign1 = Application.WorksheetFunction.Match(val2, .Cells(6, col1 + [c5].Column).Resize(24), 0) - 1
With .[c6]
If taille > 0 Then .Offset(lign1, col1 + 1).Resize(, taille).Interior.ColorIndex = 3 'rouge
If taille < 8 Then .Offset(lign1, col1 + 1 + taille).Resize(, 8 - taille).Interior.ColorIndex = 15 'gris
End With
End With
End If
End If
End Sub