Adding a data series to a chart
Dim cht as Chart
set cht = Worksheets("Server 1").ChartObjects("Chart3").Chart
now you can use the cht reference to refer to your chart.
--
Regards,
Tom Ogilvy
"Grant Reid" wrote in message
...
Hi
I have a routine that adds data series to a chart. The chart resides in
Worksheet "Server 1" and is ChartObjects("Chart 3"). The routine selects
the
chart and adds the data series.
Ideally I would like to be able to trigger this routine by clicking on a
button in another worksheet and add the data series without having to
navigate to the worksheet and select the chart. Can this be done? I have
enclosed my code below.
Sub AddSeries()
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Sheets("Server 2 Database
Space Summary").Range("B6:B19")
ActiveChart.SeriesCollection(1).Values = Sheets("Server 2 Database
Space
Summary").Range("E6:E19")
ActiveChart.SeriesCollection(1).Name = "=""MB Used"""
ActiveChart.SeriesCollection(2).XValues = Sheets("Server 2 Database
Space Summary").Range("B6:B19")
ActiveChart.SeriesCollection(2).Values = Sheets("Server 2 Database
Space
Summary").Range("F6:F19")
ActiveChart.SeriesCollection(2).Name = "=""MB Free"""
End Sub
Hope someone can help. Many thanks in advance - Grant
|