Hi,
I need some help with understanding why my macro behaves like it does.
The macro creates multiple charts from data in one sheet, but now when I'm trying to scale it up to multiple sheets, the previous charts created disappear. E.g Creates 5 charts for sheet 1 (can see them being created, using debugger mode), looping to the next chart and they are created but the first ones has disappeared! What am I doing wrong? I'm creating my chart by the following code:
With outputTrainSheet
.Activate
...
'build diagram
Dim cht1 As Object
Set cht1 = outputTrainSheet.ChartObjects.Add(Left:=Columns(startpoint * 9 + 1).Left, Width:=350, Top:=Rows(10).Top, Height:=200)
With cht1
.Chart.SetSourceData Source:=outputTrainSheet.Range(Cells(25, 2 + startpoint * 9), Cells(25 + numberOfStations, 3 + startpoint * 9))
.Chart.SeriesCollection(1).Name = "Buffert"
.Chart.SeriesCollection(2).Name = "Delay"
.Chart.SeriesCollection(2).Format.Fill.ForeColor.RGB = rgbRed
End With
The startpoint variable is changed for every new chart within the one sheet and the outputsheet is changed when you change the sheet
Thanks in advance
Carl
Bookmarks