A voir également:
- Boucle mis en forme
- Boucle mis en forme ✓ - Forum - VB / VBA
- Boucle With pour mise en forme variable ✓ - Forum - VB / VBA
- Mise en forme d'une plage données avec une boucle ✓ - Forum - VB / VBA
- Comment créer une boucle de mise en forme des cellules ✓ - Forum - VB / VBA
- Mise en forme de plusieurs graphiques (boucle For Each ?) ✓ - Forum - VB / VBA
2 réponses
jordane45
- Messages postés
- 31493
- Date d'inscription
- mercredi 22 octobre 2003
- Statut
- Modérateur
- Dernière intervention
- 25 février 2021
Bonjour,
essaye ça :
essaye ça :
Sub test() Dim c As Variant Dim rng As Range Dim derniereLigne As Long derniereLigne = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row Set rng = ActiveSheet.Range(Cells(7, 1), Cells(derniereLigne, 1)) For Each c In rng If c.Value <> "" Then With c.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 10092492 .TintAndShade = 0 .PatternTintAndShade = 0 End With With c.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With c.Borders(xlEdgeBottom) .LineStyle = xlDouble .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThick End With c.Borders(xlEdgeRight).LineStyle = xlNone c.Borders(xlInsideVertical).LineStyle = xlNone c.Borders(xlInsideHorizontal).LineStyle = xlNone End If Next c End Sub
philippine
Top ! Ca marche niquel.
Et si je veux colorer toute la ligne de cette cellule ?
Merci d'avance !!
Philippine
Et si je veux colorer toute la ligne de cette cellule ?
Merci d'avance !!
Philippine
jordane45
- Messages postés
- 31493
- Date d'inscription
- mercredi 22 octobre 2003
- Statut
- Modérateur
- Dernière intervention
- 25 février 2021
Sub test() Dim c As Variant Dim rng As Range Dim derniereLigne As Long derniereLigne = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row Set rng = ActiveSheet.Range(Cells(7, 1), Cells(derniereLigne, 1)) For Each c In rng If c.Value <> "" Then ligncell = c.Row With Rows(ligncell).Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 10092492 .TintAndShade = 0 .PatternTintAndShade = 0 End With With Rows(ligncell).Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Rows(ligncell).Borders(xlEdgeBottom) .LineStyle = xlDouble .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThick End With Rows(ligncell).Borders(xlEdgeRight).LineStyle = xlNone Rows(ligncell).Borders(xlInsideVertical).LineStyle = xlNone Rows(ligncell).Borders(xlInsideHorizontal).LineStyle = xlNone End If Next c End Sub