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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Not Intersect(Target, Range("I5:J5")) Is Nothing Then
Plage = ("B17:BC17")
x = 1
'Application sur graphique à bulles **********************
ActiveSheet.ChartObjects("Graphique 1").Activate
For Each cell In Range(Plage)
With ActiveChart.SeriesCollection(3).Points(x).Interior
If cell.Value <= [I5] Or cell.Value >= [J5] Then
.Color = RGB(255, 0, 0)
ElseIf cell.Value > [I5] Then
.Color = RGB(0, 255, 0)
End If
x = x + 1
End With
Next
'Application sur les marqueurs d'un graphique à courbes ********************
x = 1
ActiveSheet.ChartObjects("Graphique 2").Activate
For Each cell In Range(Plage)
With ActiveChart.SeriesCollection(3).Points(x)
If cell.Value <= [I5] Or cell.Value >= [J5] Then
.MarkerBackgroundColor = RGB(255, 0, 0)
ElseIf cell.Value > [I5] Then
.MarkerBackgroundColor = RGB(0, 255, 0)
End If
x = x + 1
End With
Next
'Adapter la taille des marqueurs d'un graphique à courbes proportionnellement à leurs valeurs *************
x = 1
ActiveSheet.ChartObjects("Graphique 2").Activate
For Each cell In Range(Plage)
With ActiveChart.SeriesCollection(3).Points(x)
.MarkerSize = 8 * Cells(17, x + 1) * 0.002 'taille du marqueur = taille de base du marqueur(8) * valeur du point * par un coeff
x = x + 1
End With
Next
'Application sur les marqueurs d'un graphique en nuage de points ********************
x = 1
ActiveSheet.ChartObjects("Graphique 3").Activate
For Each cell In Range(Plage)
With ActiveChart.SeriesCollection(3).Points(x)
If cell.Value <= [I5] Or cell.Value >= [J5] Then
.MarkerBackgroundColor = RGB(255, 0, 0)
ElseIf cell.Value > [I5] Then
.MarkerBackgroundColor = RGB(0, 255, 0)
End If
x = x + 1
End With
Next
'Adapter la taille des marqueurs d'un graphique en nuage de points proportionnellement à leurs valeurs *************
x = 1
ActiveSheet.ChartObjects("Graphique 3").Activate
For Each cell In Range(Plage)
With ActiveChart.SeriesCollection(3).Points(x)
.MarkerSize = 8 * Cells(17, x + 1) * 0.002 'taille du marqueur = taille de base du marqueur(8) * valeur du point * par un coeff
x = x + 1
End With
Next
End If
End Sub |
Partager