Diagramm/Bild in UF - 2003 ja - 2007 error ?
08.08.2008 22:59:03
Jens
ich hab da ein Diagramm in einer Userform, bzw ein Bild eines Diagramms.
Das Diagramm hat 4 Datenpunkte.
Unter Excel 2000 läuft es gut - unter Excel 2007 gibt es den Fehler, dass 2D Diagramme nicht mehr als 32000 Datenpunkte enthalten dürfen...aber es sind nur 4 !
Hat jemand eine Idee ?
Besten Gruß !
Jens
Der code lautet
Sub DiagrammInUserForm()
Dim cht1 As Chart
Dim cht2 As Chart
Dim cht3 As Chart
Dim cht4 As Chart
Dim cht5 As Chart
Dim cht6 As Chart
Dim frm7 As UserForm
Dim searchstring1 As String
Dim ws7 As Worksheet
Dim c7 As Range
Dim diarange1 As Range
Dim diarange2 As Range
Dim diarange3 As Range
Dim diarange4 As Range
Dim diarange5 As Range
Dim diarange6 As Range
'MsgBox "ComboBox01.Text: " & ComboBox01.Text
'MsgBox ActiveCell.Address
'MsgBox ActiveSheet.Name
Set frm7 = UserForm_FWAT_results
searchstring1 = ComboBox01.Text
Set ws7 = Sheets("Diagramm")
With ws7.Range("A:A")
Set c7 = .Find(searchstring1, LookIn:=xlValues)
End With
Sheets("Diagramm").Activate
Range("A:A").Select
Range(c7.Address).Activate
' Einlesen der Daten für die charts
Set diarange1 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=1), ActiveCell.Offset(rowOffset:=0, columnOffset:=4))
Set diarange2 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=5), ActiveCell.Offset(rowOffset:=0, columnOffset:=8))
Set diarange3 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=9), ActiveCell.Offset(rowOffset:=0, columnOffset:=12))
Set diarange4 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=13), ActiveCell.Offset(rowOffset:=0, columnOffset:=16))
Set diarange5 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=17), ActiveCell.Offset(rowOffset:=0, columnOffset:=20))
Set diarange6 = Worksheets("Diagramm").Range(ActiveCell.Offset(rowOffset:=0, columnOffset:=21), ActiveCell.Offset(rowOffset:=0, columnOffset:=24))
'MsgBox searchstring1
'MsgBox ActiveCell.Address
'MsgBox c7.Address
MsgBox diarange1.Address ERGIEBT $B$3:$E$4
' Chart 1 für Replikat 1
Set cht1 = Charts.Add
Application.ScreenUpdating = False
cht1.SetSourceData Source:=diarange1, _
PlotBy:=xlRows
With cht1
.Type = xlXYScatter
.HasTitle = True
.HasLegend = False
.HasAxis(xlValue, xlPrimary) = True
.ChartTitle.Text = "(Replikat 1)"
.SeriesCollection(1).MarkerSize = 10
End With
With ActiveChart.Axes(xlValue)
.HasTitle = True
.TickLabels.Font.Name = "Arial"
.TickLabels.Font.Size = 12
.TickLabels.Font.FontStyle = "Bold"
With .AxisTitle
.Caption = "LOG10 Skala"
.Font.Name = "Arial"
.Font.Size = 14
End With
.ScaleType = xlScaleLogarithmic ' A logarithmic scale uses base 10 logarithms.
End With
With ActiveChart.ChartArea
.Interior.ColorIndex = 50
.Border.ColorIndex = 1
End With
With ActiveChart.PlotArea
.Interior.ColorIndex = 15
.Border.ColorIndex = 15
End With
With ActiveChart.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Caption = "Tage"
.AxisTitle.Font.Name = "Arial"
.AxisTitle.Font.Size = 14
.TickLabels.NumberFormat = "0"
.MinimumScale = 0
.MaximumScale = 5
.MajorUnit = 1
.MinorUnit = 0.5
.TickLabels.Font.Name = "Arial"
.TickLabels.Font.Size = 12
.TickLabels.Font.FontStyle = "Bold"
End With
cht1.Export "Replikat1.gif"
With PlotReplikat1
.Picture = LoadPicture("Replikat1.gif")
'.AutoSize = True
End With
Application.DisplayAlerts = False
cht1.Delete
' Chart 2 für Replikat 2
etc für Charts 2-6