XL 2016 Démarrage macro à la ligne 3

Al1_44

XLDnaute Junior
Bonjour le forum,

Sur une macro de Job75:
Comment démarrer la macro à partir de la ligne n°3 afin que l'entête du tableau conserve la couleur d'origine.

Bien à vous,
 

Pièces jointes

  • AL44-2.xlsm
    17.9 KB · Affichages: 7
Solution
Bonjour,
En PJ un essai avec les modifs les plus simples, il suffit à la fin de remettre en bleu la ligne 3.
Il y a plus simple mais plus conséquent dans la modif de code, avec :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim P As Range, tablo, i&
Application.ScreenUpdating = False
[E:E,J:J,N:N,H:H].Interior.ColorIndex = xlNone 'RAZ
Set P = Range("A1", UsedRange)
tablo = P 'matrice, plus rapide
For i = 1 To UBound(tablo)
    If Not IsEmpty(tablo(i, 3)) Then If Not IsEmpty(tablo(i, 4)) Then _
        If IsEmpty(tablo(i, 5)) Or IsEmpty(tablo(i, 10)) Or IsEmpty(tablo(i, 14)) _
            Then Union(P(i, 5), P(i, 10), P(i, 14)).Interior.Color = 15773696 'bleu
                If tablo(i, 7) Like "*occasion*" And tablo(i, 8)...

sylvanu

XLDnaute Barbatruc
Supporter XLD
Bonjour,
En PJ un essai avec les modifs les plus simples, il suffit à la fin de remettre en bleu la ligne 3.
Il y a plus simple mais plus conséquent dans la modif de code, avec :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim P As Range, tablo, i&
Application.ScreenUpdating = False
[E:E,J:J,N:N,H:H].Interior.ColorIndex = xlNone 'RAZ
Set P = Range("A1", UsedRange)
tablo = P 'matrice, plus rapide
For i = 1 To UBound(tablo)
    If Not IsEmpty(tablo(i, 3)) Then If Not IsEmpty(tablo(i, 4)) Then _
        If IsEmpty(tablo(i, 5)) Or IsEmpty(tablo(i, 10)) Or IsEmpty(tablo(i, 14)) _
            Then Union(P(i, 5), P(i, 10), P(i, 14)).Interior.Color = 15773696 'bleu
                If tablo(i, 7) Like "*occasion*" And tablo(i, 8) Like "*lu*" Then P(i, 8).Interior.Color = 5296274 'vert
Next
[A3:N3].Interior.Color = RGB(190, 210, 240)     'Remise en bleu de la ligne 3
Application.ScreenUpdating = True
End Sub
 

Pièces jointes

  • AL44-2 (3).xlsm
    15.8 KB · Affichages: 4

Discussions similaires

Statistiques des forums

Discussions
312 228
Messages
2 086 420
Membres
103 205
dernier inscrit
zch