AW: Objekt formatieren mit Makro
03.12.2003 20:12:50
Steffan
Hallo Jens, bin leider nicht gut in VBA! Ich habe die Zeile, die du mir geschrieben hast eingefügt. Das Resultat war ein Absturz von Excel!! Ich hänge mein Diagramm erzeugendes Makro hier mal an. Vielleicht wirst du daraus schlau und kannst mir weiterhelfen.
Gruß
Steffan
Sub Diagramm_Bartels()
' Diagramm_Bartels Makro
Sheets("Leistungsprüfung").Select
Selection.AutoFilter Field:=2, Criteria1:="Bartels"
Range("A2:A100").Select
ActiveWindow.ScrollRow = 1
Range("A2:A100,K2:K100").Select
Range("K2").Activate
ActiveWindow.ScrollRow = 1
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Leistungsprüfung").Range( _
"A2:A100,K2:K100"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Auswertung"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Diagramm Bartels"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveChart
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True
End With
ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
ActiveChart.HasLegend = False
ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowValue, LegendKey:=False
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScale = 10
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
End With
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 3
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Diagramm 29").ScaleWidth 1.49, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("Diagramm 29").IncrementLeft -45#
ActiveSheet.Shapes("Diagramm 29").IncrementTop 0.75
ActiveSheet.Shapes("Diagramm 29").ScaleWidth 1.09, msoFalse, _
msoScaleFromTopLeft
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Position = xlLabelPositionOutsideEnd
.Orientation = xlUpward
End With
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
Windows("Atemschutzleistungsprüfung.xls").ScrollColumn = 25
Windows("Atemschutzleistungsprüfung.xls").ScrollColumn = 10
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Diagramm 29").ScaleWidth 1.91, msoFalse, _
msoScaleFromTopLeft
Windows("Atemschutzleistungsprüfung.xls").ScrollColumn = 1
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Standard"
.Size = 6
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScale = 7
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
End With
End Sub