Private Sub CommandButton1_Click()
Worksheets("Grafiek aantal soort klacht").Activate
a = Range("B3:B3").Value
If a = 46 Then b = "c240:i240"
If a = 47 Then b = "c246:i246"
If a = 48 Then b = "c252:i252"
If a = 49 Then b = "c258:i258"
Worksheets("Grafiek aantal soort klacht").Range("H15:H15").Select
'Range(b).Select
ActiveSheet.ChartObjects.Delete
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets("Invoer int. klachten vitrage"). _
Range(b), PlotBy:=xlRows
ActiveChart.SeriesCollection(1).XValues = _
"='Invoer int. klachten vitrage'!R5C3:R5C9"
ActiveChart.SeriesCollection(1).Name = ""
ActiveChart.Location Where:=xlLocationAsObject, Name:="Grafiek aantal soort klacht"
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
False, HasLeaderLines:=True, ShowSeriesName:=False, ShowCategoryName:= _
False, ShowValue:=True, ShowPercentage:=False, ShowBubbleSize:=False
Selection.Interior.ColorIndex = xlNone
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
ActiveChart.Legend.Select
ActiveChart.Legend.LegendEntries(1).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 32
.Pattern = xlSolid
End With
ActiveChart.Legend.LegendEntries(2).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 27
.Pattern = xlSolid
End With
ActiveChart.Legend.LegendEntries(3).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 10
.Pattern = xlSolid
End With
ActiveChart.Legend.LegendEntries(7).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
ActiveChart.Legend.LegendEntries(5).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ActiveChart.Legend.LegendEntries(6).LegendKey.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
ActiveWindow.Visible = False
Windows("interne externe klachten.xls").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "interne klachten vitrage"
End With
End Sub