aide pour ajouter une condition au code vba

moutchec

XLDnaute Occasionnel
bonjour le forum,
j'ai besoin d'aide pour ajouter une condition au code vba ci dessous :

For T = 2 To Sheets("Planning").Range("H" & Rows.Count).End(xlUp).Row
For P = 4 To Sheets("Stocks").Range("E" & Rows.Count).End(xlUp).Row
If CStr(Sheets("Planning").Range("H" & T)) = CStr(Sheets("Stocks").Range("E" & P)) Then (ici une 2eme condition = et si sheets "Stocks" range "J" commence à gauche par "NC" then....)
Sheets("Planning").Range("G" & z).Interior.ColorIndex = 21
Sheets("Planning").Range("G" & z).Font.ColorIndex = 6
Sheets("Planning").Range("G" & z).Font.Size = 14
End If
Next
Next

merci d'avance.
Moutchec.
 

moutchec

XLDnaute Occasionnel
Bonjour Moutchec
Quelle ligne de la colonne J ?????
left(Range("J" & T ),2)="NC" ou left(Range("J" & P),2)="NC"
RE :
voici ce que j'ai fait mais ça bloque, aucun résultat après de 2 minutes

For q = 2 To Sheets("Planning").Range("D" & Rows.Count).End(xlUp).Row
For r = 2 To Sheets("Planning").Range("H" & Rows.Count).End(xlUp).Row
For s = 4 To Sheets("Stocks").Range("E" & Rows.Count).End(xlUp).Row
For T = 4 To Sheets("Stocks").Range("J" & Rows.Count).End(xlUp).Row
If CStr(Sheets("Planning").Range("H" & r)) = CStr(Sheets("Stocks").Range("E" & s)) And CStr(Sheets("Stocks").Range("J" & T)) = "NC" Then
Sheets("Planning").Range("D" & q).Interior.ColorIndex = 21
Sheets("Planning").Range("D" & q).Font.ColorIndex = 6
Sheets("Planning").Range("D" & q).Font.Size = 14
End If
Next
Next
Next
Next
 

Membres actuellement en ligne

Statistiques des forums

Discussions
312 196
Messages
2 086 100
Membres
103 116
dernier inscrit
kutobi87