Améliorer code VBA pour mise en forme
Je suis à la recherche d'une solution plus simple afin de ne pas ralentir la saisie ds ma feuille.
Les cellules de la colonne A conditionnent la couleur ds les cellules qui sont sur la même ligne pour colonne B à F.
Merci d'avance pour votre aide
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i&
With Feuil14
For i = 1 To 6000
'si cellule colonne A # vide et cellules colonnes B a F # vide
If .Cells(i, 1) <> "" Then
For j = 1 To 6
If .Cells(i, j) <> "" Then
Cells(i, j).Interior.ColorIndex = 3
End If
Next j
End If
'si cellule colonne A = vide et cellules colonnes B a F # vide
If .Cells(i, 1) = "" Then
For j = 1 To 6
If Cells(i, j) <> "" Then
Cells(i, j).Interior.ColorIndex = 4
End If
Next j
End If
'si cellule colonne A = vide et cellules colonnes B a F = vide
If .Cells(i, 1) = "" Then
For j = 1 To 6
If .Cells(i, j) = "" Then
Cells(i, j).Interior.ColorIndex = xlNone
End If
Next j
End If
'si cellule colonne A # vide et cellules colonne B à F = vide
If .Cells(i, 1) <> "" Then
For j = 1 To 6
If .Cells(i, j) = "" Then
Cells(i, j).Interior.ColorIndex = xlNone
End If
Next j
End If
Next i
End With
End Sub |