Laufzeitfehler 1004
07.07.2004 10:36:09
Dirk
beim ausführen des makros bleibt das makro immer an der unten makierten Stellen stehen (Makierung so *Fehler*)
----
Laufzeitfehler 1004
Die select methode des chat objects konnte nicht ausgeführt werden .....
vielleicht hat jemand einen tip
---
danke dirk
Option Explicit
Private Sub Werte_Click()
Dim i As Integer
Dim zeile As Integer
Dim spalte As Integer
Dim bereich1 As String
Dim bereich2 As String
Dim bereich3 As String
Sheets("Tabelle1").Select
' kopiere neue daten in wertetabelle
zeile = 9 'start koordinaten
spalte = 7
While (Worksheets("Tabelle1").Cells(zeile, spalte) <> "")
zeile = zeile + 2
Wend
'kopiere werte
Worksheets("Tabelle1").Cells(zeile, spalte) = Worksheets("Tabelle1").Cells(7, 3)
Worksheets("Tabelle1").Cells(zeile + 1, spalte) = Worksheets("Tabelle1").Cells(8, 3)
Worksheets("Tabelle1").Cells(zeile, spalte + 1) = Worksheets("Tabelle1").Cells(7, 4)
Worksheets("Tabelle1").Cells(zeile + 1, spalte + 1) = Worksheets("Tabelle1").Cells(8, 4)
Worksheets("Tabelle1").Cells(zeile, spalte - 1) = Worksheets("Tabelle1").Cells(zeile - 2, spalte - 1) + 1
' bereiche bestimmen
bereich1 = "=Tabelle1!R" + CStr(zeile) + "C" + CStr(spalte) + ":R" + CStr(zeile + 1) + "C" + CStr(spalte)
bereich2 = "=Tabelle1!R" + CStr(zeile) + "C" + CStr(spalte + 1) + ":R" + CStr(zeile + 1) + "C" + CStr(spalte + 1)
bereich3 = "=Tabelle1!R" + CStr(zeile) + "C" + CStr(spalte - 1)
*Fehler* Sheets("Diagramm1").Select
i = Worksheets("Tabelle1").Cells(zeile, spalte - 1)
' neue Datenreihe
If (ActiveChart.SeriesCollection.Count < i) Then
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Select
With Selection.Border ' Linie einstellen
.ColorIndex = 5
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection ' keine Punkte
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = xlNone
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 3
.Shadow = False
End With
End If
ActiveChart.SeriesCollection(i).XValues = bereich1
ActiveChart.SeriesCollection(i).Values = bereich2
ActiveChart.SeriesCollection(i).Name = bereich3
' titel und achsenbeschriftungen setzen
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = Worksheets("Tabelle1").Cells(11, 3)
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = Worksheets("Tabelle1").Cells(5, 3) + " [" + Worksheets("Tabelle1").Cells(6, 3) + "]"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = Worksheets("Tabelle1").Cells(5, 4) + " [" + Worksheets("Tabelle1").Cells(6, 4) + "]"
End With
Sheets("Tabelle1").Select
Range("A1").Select
End Sub