Dim plage, maplage
Set plage = Sheets("Sheet1").Range("A1").CurrentRegion
Application.ScreenUpdating = False
Sheets("Sheet1").Activate
Set maplage = Range("A1").CurrentRegion
maplage.Name = "TCD"
Sheets("Sheet3").Activate
With ActiveSheet
.PivotTableWizard SourceType:=xlDatabase, SourceData:="TCD", TableDestination:="R1C1", TableName:="TCD1"
.PivotTables("TCD1").SmallGrid = False
.PivotTables("TCD1").AddFields RowFields:="Sc", ColumnFields:=Array("Arrêt")
.PivotTables("TCD1").PivotFields("%").Orientation = xlDataField
End With
With Application
.CommandBars("PivotTable").visible = False
.ScreenUpdating = False
End With
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet3").Range("A3:E6"), PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet3"
ActiveChart.SeriesCollection(1).Select
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Arrêt"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "%"
End With
ActiveChart.HasLegend = True
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With