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
| Sub GraphPie()
'Selectionner la plage de reconnaissance
Dim Valeurs As Range
Dim Etiquette As Range
Set Valeurs = Range("D1")
Set Etiquette = Range("A1")
MotSpe = "ETAT"
Table_Ref = Array("Alex", "Toto", "Robert", "Michel", "Raoul", "Rufus", "Ken")
For Each Cell In Range("A1:A40")
For Each TblVal In Table_Ref
If ((InStr(TblVal, CStr(Cell.Value)) = 1) And (InStr(MotSpe, CStr(Cell.Value)) = 0)) Then
Etiquette = Union(Etiquette, Range(Cell)) '<- Mon Probleme
Valeurs = Union(Valeurs, Range(Cell(Cell.Row, 4))) '<- Mon Probleme
End If
Next TblVal
Next Cell
Valeurs.Select
mysheetname = ActiveSheet.Name
Charts.Add
ActiveChart.ChartWizard _
Source:=Sheets(mysheetname).Range(Valeurs), _
Gallery:=xlLine, Format:=4, PlotBy:=xlRows, _
CategoryLabels:=1, SeriesLabels:=1, HasLegend:=1, _
Title:="", CategoryTitle:="", _
ValueTitle:="", ExtraTitle:=""
End Sub |
Partager