Code VBA automatisé ou formule magique

Salut à l'aide encore une fois besoin code vba ou formule qui peux automatiser comme sur mon image quand je sélectionne un numéro il deviens noir mais quand mes 3 numéro du centre son sélectionne noir les deux restant au extrémité dois devenir rouge automatiquement j'ai beau aseiller mais sa fonctionne pas merci !!

shitt

Salut Mart,

quelque chose comme ça ?

If Not Intersect(Target, [CADRE].Cells) Is Nothing Then
    iCol = Target.Column
    Target.Interior.Color = IIf(Target.Interior.Color = RGB(5, 130, 130), RGB(0, 0, 0), RGB(5, 130, 130))
    Union(Cells([CADRE].Row, iCol), Cells([CADRE].Row + 4, iCol)).Interior.Color = _
        IIf(Cells([CADRE].Row, iCol).Interior.Color = RGB(5, 130, 130) And _
            Cells([CADRE].Row + 1, iCol).Interior.Color = RGB(0, 0, 0) And _
            Cells([CADRE].Row + 2, iCol).Interior.Color = RGB(0, 0, 0) And _
            Cells([CADRE].Row + 3, iCol).Interior.Color = RGB(0, 0, 0) And _
            Cells([CADRE].Row + 4, iCol).Interior.Color = RGB(5, 130, 130), RGB(255, 0, 0), RGB(5, 130, 130))
    [CADRE].Cells(1, 3).Offset(0, 1).Select
End If
22mart.xlsm (17.04 Ko)

A+

Merci beaucoup !!!!

Salut curulis57 je n'arrive pas à le faire fonctionner sur mon fichier si jamais tu veux l'intègre

22exemple-copie.xlsm (124.59 Ko)

a mon fichier je le laisse ici merci encore !!

Rechercher des sujets similaires à "code vba automatise formule magique"