Bonjour le Forum,
En saisissant 100 dans la colonne A, grâce au code si dessous, la ligne d'à coté se colorie en bleu. (Ligne B à J)
Ma Question est :
Est ce qu'il y a moyen de racourcir ce code ? De l'optimiser ?
Merci pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim x As Variant For Each x In Range("A1:A" & Range("A65536").End(xlUp).Row) If x = 100 Then x.Rows.Offset(0, 1).Interior.ColorIndex = 8 x.Rows.Offset(0, 2).Interior.ColorIndex = 8 x.Rows.Offset(0, 3).Interior.ColorIndex = 8 x.Rows.Offset(0, 4).Interior.ColorIndex = 8 x.Rows.Offset(0, 5).Interior.ColorIndex = 8 x.Rows.Offset(0, 6).Interior.ColorIndex = 8 x.Rows.Offset(0, 7).Interior.ColorIndex = 8 x.Rows.Offset(0, 8).Interior.ColorIndex = 8 x.Rows.Offset(0, 9).Interior.ColorIndex = 8 End If Next x End Sub
Cdt, Anto.
PC.
Office 2003.
XP.
Partager