PDA

View Full Version : Create "draggable" series name for chart created in VBA



khu
06-19-2013, 11:14 AM
For iColumn = 1 To rngChtYVal.Columns.Count
With .SeriesCollection.NewSeries
.Values = rngChtYVal.Columns(iColumn).Cells
.XValues = rngChtXVal
.Name = Range(rngChtYVal(1, iColumn).Offset(-1, 0).Address)



In my program the user defines a column of X values and a range of Y data, then this section of the code makes a series for each column of Y data for the defined Y data range and plots it.

I'm having trouble getting excel to allow the series name to be a moveable cell selection if you click on the line on the chart.

If I click on the a line in the chart, the data for the series is highlighted and I can drag the box to a new set of data if I wish. It does not recognize the .Name = Range(rngChtYVal(1, iColumn).Offset(-1, 0).Address) the same way.

If I go into "Select Data" in the chart properties, and then pick a cell that has the name as text, excel treats it dynamically and will highlight that cell if I click on the series again. This is how I'd like my code to be treated.


I hope this is clear.



I could not get the pictures to work, sorry.


Any thoughts?


Thanks,

Khu

khu
06-21-2013, 09:26 AM
Nothing?