Coloration de cellules
micbre
Messages postés
17
Statut
Membre
-
micbre Messages postés 17 Statut Membre -
micbre Messages postés 17 Statut Membre -
Bonjourà tous.
J'ai,il y a peu,entamé une discussion,sous le même titre,que j'ai déclaré résolue,car tout fonctionne parfaitement.
Mon problème actuel,est le suivant:
J'ai ouvert deux nouveaux tableaux dans un autre dossier,et j'ai voulu y adapter le code qui m'a été élaboré par un correspondant sur ce forum.
J'ai suivi le pas à pas détaillé qui avait bien fonctionné,la première fois,mais je n'obtiens aucun résultat.
Je crée mon bouton ActiveX,je copie mes codes dans la fenêtre VBA,,je désactive le mode création,et: RIEN !
Qu'est-ce que j'oublie ?
Private Sub CommandButton1_Click()
Dim x As Range
For Each x In Range("v6: v66,v80: v140")
If x <> "" And x.Interior.ColorIndex <> xlNone Then
x.Interior.ColorIndex = 3
End If
Next x
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Selection, Range("v6: v66,v80: v140")) Is Nothing Then
If Target <> "" And Target.Interior.ColorIndex = 3 Then
With Selection.Interior
.Pattern = xlPatternLinearGradient
.Gradient.Degree = 45
.Gradient.ColorStops.Clear
End With
With Selection.Interior.Gradient.ColorStops.Add(0)
.Color = 16777164
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.45)
.Color = 16777164
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.55)
.Color = 10092543
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(1)
.Color = 10092543
.TintAndShade = 0
End With
Cancel = True
End If
End If
End Sub
A +
micbre
J'ai,il y a peu,entamé une discussion,sous le même titre,que j'ai déclaré résolue,car tout fonctionne parfaitement.
Mon problème actuel,est le suivant:
J'ai ouvert deux nouveaux tableaux dans un autre dossier,et j'ai voulu y adapter le code qui m'a été élaboré par un correspondant sur ce forum.
J'ai suivi le pas à pas détaillé qui avait bien fonctionné,la première fois,mais je n'obtiens aucun résultat.
Je crée mon bouton ActiveX,je copie mes codes dans la fenêtre VBA,,je désactive le mode création,et: RIEN !
Qu'est-ce que j'oublie ?
Private Sub CommandButton1_Click()
Dim x As Range
For Each x In Range("v6: v66,v80: v140")
If x <> "" And x.Interior.ColorIndex <> xlNone Then
x.Interior.ColorIndex = 3
End If
Next x
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Selection, Range("v6: v66,v80: v140")) Is Nothing Then
If Target <> "" And Target.Interior.ColorIndex = 3 Then
With Selection.Interior
.Pattern = xlPatternLinearGradient
.Gradient.Degree = 45
.Gradient.ColorStops.Clear
End With
With Selection.Interior.Gradient.ColorStops.Add(0)
.Color = 16777164
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.45)
.Color = 16777164
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(0.55)
.Color = 10092543
.TintAndShade = 0
End With
With Selection.Interior.Gradient.ColorStops.Add(1)
.Color = 10092543
.TintAndShade = 0
End With
Cancel = True
End If
End If
End Sub
A +
micbre
A voir également:
- Coloration de cellules
- Somme de plusieurs cellules excel - Guide
- Verrouiller cellules excel - Guide
- Fusionner deux cellules excel - Guide
- Colorer des cellules excel sous condition - Guide
- Afficher cellules masquées excel ✓ - Forum Excel