Hello,
i'm working with excel and especially with VBA since about two months. This forum and the solved problems were a great help getting into programming but now I have a problem myself i cant solve, using this board and other databases on the internet.
I'm programming a tool, which shall automatically create a Chart with all the data from coloumbs in the worksheet, to get an overview.
Sub diagexcel()
Dim B As Double
Dim H As Double
H = 4
Do While Not Cells(B , 2).Value = Empty
B = B + 2
Loop
H = B + 2
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""EPower"""
ActiveChart.SeriesCollection(1).Values = _
"='Power'!Z4S6:Z" & B & "S6" ' its meant to take all data in the coloumb S6 but it shows Runtimeerror 1004 and i expect the same error for the following SeriesCollections
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Name = "=""M 1"""
ActiveChart.SeriesCollection(2).Values = "=Tabelle1!Z6S29:Z" & H & "S29"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Name = "=""M 2"""
ActiveChart.SeriesCollection(3).Values = "=Tabelle1!Z6S30:Z" & H & "S30"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).Name = "=""M 3"""
ActiveChart.SeriesCollection(4).Values = "=Tabelle1!Z6S31:Z" & H & "S31"
ActiveChart.SeriesCollection(4).XValues = _
"='Power'!Z4S2:Z" & B & "S2"
...
End Sub
Edit: Maybe there is just a misspelling in the red part?
I hope you have an idea, it would be a great help!
Bookmarks