folgendes Programm sollte eigentlich zu einer Formel ein Diagramm ausgeben, wobei das Intervall der x-Achse frei wählbar ist!
Könnt ihr uns helfen, die bestehenden Fehler zu beheben?
Danke!
Sub test()
Dim x As Integer
Dim y As Double
Dim min As Double
Dim max As Double
Dim a As Double
Dim Imin As Double
Dim Imax As Double
Dim Istep As Double
On Error GoTo Err_Message
Imin = InputBox("Bitte den kleinsten Wert eingeben:")
Cells(6, 2) = Imin
Imax = InputBox("Bitte den größten Wert eingeben:")
Cells(6, 3) = Imax
Istep = InputBox("Bitte Step eigeben")
Cells(6, 5) = Istep
If Imin > Imax Then
MsgBox ("So geht's aber nicht!!!")
End
End If
min = Cells(6, 2)
max = Cells(6, 3)
y = Cells(6, 5)
x = 1
For a = min To max Step y
Cells(x, 8) = a
x = x + 1
Cells(x - 1, 9) = a ^ 2 + 10
Next
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Tabelle1").Range(Cells(1, 9), Cells(max, 9)), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Tabelle1!R1C8:R9C8"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Tabelle1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
Err_Message:
MsgBox ("Fehler!")
End Sub