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
| 'celle ci permet de créer tous les tableaux DUREE CURATIF SEMAINE
Sub SelectionnerLignes1(Feuille As Worksheet, ValA As Variant, ValB As Variant)
Dim Cellule As Range, Plage As Range
Dim i As Long
Dim MonGraphe As Chart, MaPlage As Range
For Each Cellule In Feuille.Range("B3:b" & Feuille.Range("b" & Feuille.Rows.Count).End(xlUp).Row)
If Not IsEmpty(ValB) Then
If Cellule = ValA And Cellule(1, 2) = ValB Then
If Plage Is Nothing Then Set Plage = Union(Cellule, Cellule(1, 2), Cellule(1, 3), Cellule(1, 4), Cellule(1, 5), Cellule(1, 6), Cellule(1, 7), Cellule(1, 8), Cellule(1, 9), Cellule(1, 10), Range("C2:K2")) Else Set Plage = Union(Plage, Cellule, Cellule(1, 2), Cellule(1, 3), Cellule(1, 4), Cellule(1, 5), Cellule(1, 6), Cellule(1, 7), Cellule(1, 8), Cellule(1, 9), Cellule(1, 10), Range("C2:K2"))
End If
Else
If Cellule = ValA Then
If Plage Is Nothing Then Set Plage = Union(Cellule, Cellule(1, 2), Cellule(1, 3), Cellule(1, 4), Cellule(1, 5), Cellule(1, 6), Cellule(1, 7), Cellule(1, 8), Cellule(1, 9), Cellule(1, 10), Range("C2:K2")) Else Set Plage = Union(Plage, Cellule, Cellule(1, 2), Cellule(1, 3), Cellule(1, 4), Cellule(1, 5), Cellule(1, 6), Cellule(1, 7), Cellule(1, 8), Cellule(1, 9), Cellule(1, 10), Range("C2:K2"))
End If
End If
Next Cellule
Feuille.Select
If Not Plage Is Nothing Then Plage.Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Plage, PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="INDICATEUR"
With ActiveChart.Parent
.Height = 325 ' resize
.Width = 1000 ' resize
.Top = Range("A4").Top ' reposition
.Left = Range("A4").Left ' reposition
End With
End Sub |
Partager