Chart to slow
07.07.2008 10:36:44
Rosenwasser
Die unterstehende Code funktioniert ziemlich schnell mit Excel 2003.
Bei Ausführung mit Excel 2007 wird die Geschwindigkeit dramatisch langsam.
Wie kann ich diese Code schneller laufen lassen in Excel 2007?
Vielen Dank
Sub BalkenKleur()
Dim i As Integer
Dim x As Integer
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With ActiveChart.ChartGroups(1)
.Overlap = 0
.GapWidth = 0
.HasSeriesLines = False
.VaryByCategories = False
End With
On Error GoTo ERRORHANDLER
Application.ScreenUpdating = False
ActiveChart.SeriesCollection(1).ApplyDataLabels Type:=xlDataLabelsShowValue, _
AutoText:=True
For x = 1 To ActiveChart.SeriesCollection.Count
For i = 1 To ActiveChart.SeriesCollection(x).Points.Count
ActiveChart.SeriesCollection(x).Points(i).DataLabel.Select
If CDbl(Selection.Text) = "5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 3
ElseIf CDbl(Selection.Text) >= "4,5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 3
ElseIf CDbl(Selection.Text) >= "4" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 22
ElseIf CDbl(Selection.Text) >= "3,5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 46
ElseIf CDbl(Selection.Text) >= "3" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 45
ElseIf CDbl(Selection.Text) >= "2,5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 40
ElseIf CDbl(Selection.Text) >= "2" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 44
ElseIf CDbl(Selection.Text) >= "1,5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 36
ElseIf CDbl(Selection.Text) >= "1" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 50
ElseIf CDbl(Selection.Text) >= "0,5" Then
ActiveChart.SeriesCollection(x).Points(i).Interior.ColorIndex = 43
End If
Next i
Next x
ActiveChart.SeriesCollection(1).ApplyDataLabels Type:=xlDataLabelsShowNone, _
AutoText:=True
Application.ScreenUpdating = True
Exit Sub
ERRORHANDLER:
MsgBox "De procedure is vastgelopen"
End Sub