je reviens un peu sur mon PC après quelques semaines d'absence et je
suis confronté à un problème de mise en couleur de "shapes";
j'ai une liste de communes avec une couleur de fond sur la ligne qui la
contient, j'aimerais remplir la carte à sa gauche suivant la teinte de
cette cellule, donc si Charleroi est en bleu dans la liste , la région
de charleroi sur la carte sera bleue; ici j'ai un code avec un double
clic mais je voudrais une boucle sur l'ensemble des (max 36) communes
et je n'y arrive pas :(
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
MichD
Bonjour,
Essaie comme ceci :
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes If C.Row = 37 Then Stop With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
Bonjour,
Essaie comme ceci :
'------------------------------------------------------
Sub MichD()
Dim Communes As Range, C As Range, Sh As Shape
With Feuil5 'Ou Worksheets("CarteCouleur2014")
Set Communes = .Range("Y2:Y37")
End With
For Each C In Communes
If C.Row = 37 Then Stop
With Feuil5.Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End Sub
'------------------------------------------------------
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes If C.Row = 37 Then Stop With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
MichD
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------
Sub MichD()
Dim Communes As Range, C As Range, Sh As Shape
With Feuil5 'Ou Worksheets("CarteCouleur2014")
Set Communes = .Range("Y2:Y37")
End With
For Each C In Communes
With Feuil5.Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End Sub
'------------------------------------------------------
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
MichD
Tu peux utiliser cette présentation du code si tu préfères :
'-------------------------------------------- Sub MichD() Dim C As Range With Feuil5 'Ou Worksheets("CarteCouleur2014") For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row) With .Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End With End Sub '--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion : mv8u2u$2ro$
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
Tu peux utiliser cette présentation du code si tu préfères :
'--------------------------------------------
Sub MichD()
Dim C As Range
With Feuil5 'Ou Worksheets("CarteCouleur2014")
For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row)
With .Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End With
End Sub
'--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion : mv8u2u$2ro$1@speranza.aioe.org...
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------
Sub MichD()
Dim Communes As Range, C As Range, Sh As Shape
With Feuil5 'Ou Worksheets("CarteCouleur2014")
Set Communes = .Range("Y2:Y37")
End With
For Each C In Communes
With Feuil5.Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End Sub
'------------------------------------------------------
Tu peux utiliser cette présentation du code si tu préfères :
'-------------------------------------------- Sub MichD() Dim C As Range With Feuil5 'Ou Worksheets("CarteCouleur2014") For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row) With .Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End With End Sub '--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion : mv8u2u$2ro$
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
Patrick
Merci Denis :)
simple et efficace :)
Patrick
Le 10/10/2015 11:47, MichD a écrit :
Tu peux utiliser cette présentation du code si tu préfères :
'-------------------------------------------- Sub MichD() Dim C As Range With Feuil5 'Ou Worksheets("CarteCouleur2014") For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row) With .Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End With End Sub '--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion : mv8u2u$2ro$
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
--- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
Merci Denis :)
simple et efficace :)
Patrick
Le 10/10/2015 11:47, MichD a écrit :
Tu peux utiliser cette présentation du code si tu préfères :
'--------------------------------------------
Sub MichD()
Dim C As Range
With Feuil5 'Ou Worksheets("CarteCouleur2014")
For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row)
With .Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End With
End Sub
'--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion :
mv8u2u$2ro$1@speranza.aioe.org...
Supprime cette ligne de code de la procédure, elle n'a plus aucune
utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------
Sub MichD()
Dim Communes As Range, C As Range, Sh As Shape
With Feuil5 'Ou Worksheets("CarteCouleur2014")
Set Communes = .Range("Y2:Y37")
End With
For Each C In Communes
With Feuil5.Shapes.Range(Array(C.Value)).Fill
.Visible = msoTrue
.ForeColor.RGB = C.Interior.Color
End With
Next
End Sub
'------------------------------------------------------
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Tu peux utiliser cette présentation du code si tu préfères :
'-------------------------------------------- Sub MichD() Dim C As Range With Feuil5 'Ou Worksheets("CarteCouleur2014") For Each C In .Range("Y2:Y" & .Range("Y" & .Rows.Count).End(xlUp).Row) With .Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End With End Sub '--------------------------------------------
"MichD" a écrit dans le message de groupe de discussion : mv8u2u$2ro$
Supprime cette ligne de code de la procédure, elle n'a plus aucune utilité...
If C.Row = 37 Then Stop
'------------------------------------------------------ Sub MichD() Dim Communes As Range, C As Range, Sh As Shape With Feuil5 'Ou Worksheets("CarteCouleur2014") Set Communes = .Range("Y2:Y37") End With
For Each C In Communes With Feuil5.Shapes.Range(Array(C.Value)).Fill .Visible = msoTrue .ForeColor.RGB = C.Interior.Color End With Next End Sub '------------------------------------------------------
--- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus