markus: VBA *grrr

Beitrag lesen

Hallo Jörg,

mmh mit den makros ist das so  ne sache, bin ja schon fast fertig, ich muss nur noch erreichen das, das diagramm auf dem von mir gewünschten tabellenblatt erzeugt wird und halt überschrieben wenn es schon da ist: hast du viel. ne idee hier mal der quelltext
Private Sub make_chart_Click()
    Dim chart_name As String
    Dim anzahl As Long
    Dim intSpalte As Integer
    Dim lngZ As Long
    Dim lngZeile As Long
       If (CheckBox1.Value = True) Then
        chart_name = "Nitrat"
    ElseIf (CheckBox2.Value = True) Then
        chart_name = "Nitrit"
    ElseIf (CheckBox3.Value = True) Then
        chart_name = "Gesamthärte"
    ElseIf (CheckBox4.Value = True) Then
        chart_name = "Carbonhärte"
    ElseIf (CheckBox5.Value = True) Then
        chart_name = "pH_Wert"
    End If
    If (chart_name = "") Then
    Else
        Dim chtChart As Chart
        Set chtChart = Charts.Add

With Worksheets("Daten")

lngZ = .Cells(.Rows.Count, 1).End(xlUp).Row
              If lngZ > lngZeile Then lngZeile = lngZ

End With
            MsgBox (lngZ)

With chtChart
            .Name = chart_name
            .ChartType = xlXYScatterLines
            .SetSourceData Source:=Sheets("Daten").Range("B12:B" & lngZeile), _
                PlotBy:=xlColumns
            .HasTitle = True
            .ChartTitle.Text = "=Sheet1!R1C2"
            .Axes(xlCategory, xlPrimary).HasTitle = True
            .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Month"
            .Axes(xlValue, xlPrimary).HasTitle = True
            .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Sales"
            End With
    End If
End Sub

MFG Markus