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
| Private Sub Worksheet_Change(ByVal Target As Range)
'Trigger dans la "feuil1"
AdrCell = Target.Address 'récupère adresse cellule dans variable
Select Case AdrCell
Case "$B$4" ', "une autre cellule", "encore une"....
Sheets("feuil2").ChartObjects("Graphique 2").Activate 'les graphs sont dans la feuille 2
With ActiveChart
.FullSeriesCollection(1).Format.Line.Weight = 2 * Sheets("feuil3").Range("D11").Value 'épaisseur série de donnée 1 (valeur dans la feuille 3 mais peu importe)
.FullSeriesCollection(2).Format.Line.Weight = 2 * Sheets("feuil3").Range("D12").Value 'épaisseur série de donnée 2
.Refresh 'le .Refresh ne change rien à mon problème
End With
Sheets("feuil2").ChartObjects("Graphique 1").Activate 'pareil pour le deuxième graph
With ActiveChart
.FullSeriesCollection(1).Format.Line.Weight = 2 * Sheets("feuil2").Range("I5").Value
.FullSeriesCollection(2).Format.Line.Weight = 2 * Sheets("feuil2").Range("I6").Value
.Refresh
End With
With Worksheets("feuil1") 'Pour remettre le curseur sur la cellule trigger (ne pas perturber l'utilisateur)
.Activate 'je ne sais pas s'il y a une meilleure méthode mais ça fonctionne
.Range(AdrCell).Activate
End With
End Select
End Sub |
Partager