AW: Makros: Ein Teil nur ein Mal ausführen
19.08.2008 11:22:25
wowa
Hallo Tobias!
Das ist mein Makro:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.ScreenUpdating = False
ActiveChart.Shapes("Rectangle 2").Select
Selection.Delete
ActiveChart.SeriesCollection(3).Select
ActiveChart.ChartGroups(1).SeriesCollection(3).PlotOrder = 4
ActiveChart.SeriesCollection(4).DataLabels.Select
Selection.Font.ColorIndex = 16
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ChartType = xlLine
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
With Selection
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
ActiveChart.SeriesCollection(3).DataLabels.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlContext
.Position = xlLabelPositionAbove
.Orientation = xlHorizontal
End With
ActiveChart.SeriesCollection(4).Select
ActiveChart.SeriesCollection(4).Points(4).Select
ActiveChart.SeriesCollection(4).ChartType = xlLine
ActiveChart.SeriesCollection(4).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
With Selection
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
ActiveChart.SeriesCollection(4).DataLabels.Select
ActiveChart.SeriesCollection(4).Points(1).DataLabel.Select
Selection.Left = 66
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(2).DataLabel.Select
Selection.Left = 145
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(3).DataLabel.Select
Selection.Left = 227
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(4).DataLabel.Select
Selection.Left = 308
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(5).DataLabel.Select
Selection.Left = 389
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(6).DataLabel.Select
Selection.Left = 472
Selection.Top = 22
ActiveChart.SeriesCollection(4).Points(7).DataLabel.Select
Selection.Left = 553
Selection.Top = 22
ActiveChart.SeriesCollection(2).DataLabels.Select
Selection.Font.ColorIndex = 2
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Font.ColorIndex = 2
End Sub
und zeile 3 und 4 sollen nur ein Mal abgespielt werden. Das ist ein Makro für ein PivotChart und in Zeilen 3-4 wird ein Rechteck der das Diagramm verdeckt gelöscht... Danach ist der Rechteck ja nicht mehr da und es kommt ein Fehler....
Danke!
Gruß, Wowa