View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Libby Libby is offline
external usenet poster
 
Posts: 151
Default Chart - Variable Series Collection

Thanks Peter,

I knew there must be a way.

I'm interested in being able to do this without code, but don't know much
about dyamic ranges.

Basically the range that the chart is created from has a set number of
columns each representing a project and the rows represent the people. These
people then enter the hours spent in the appropriate project.

However, not all the projects are wanted in the chart so I've used a cell
above each column header to indicate whether it's included. Potentially any
combination of columns can be included and I haven't found a way of
non-programmatically finding out which columns to include.

"Peter T" wrote:

Only rarely is it necessary to Select or Activate anything,

With Sheet1.ChartObjects("Chart 1").Chart
.SeriesCollection(1).Values = "=Sheet1!R3C2:R11C2"
' other stuff, eg .SeriesCollection(1).XValues =
End With

Maybe you could use a Dynamic Named Range instead, no code

Regards,
Peter T

"Libby" wrote in message
...
Hi,

I have a set of data that is linked to a chart. The range occupied by the
data is variabe and I have code that find the new range and updates the
Series Collection of the Chart.

The code for setting the series collection is similar to this in that the
chart is activated before being changed.
Sheet1.Chartobjects("Chart 1).activate
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R3C2:R11C2"

This works, but the problem is that the workbook needs to be shared and

thus
the charts cannot be activated.
Does anyone know how to refer to the SeriesCollection values without
activating the chart first?

Many thanks in advance.