I've written in before a couple of times with problems that members have
been good enough to solve. So here goes again ...
As part of the same application (graphing engineering data), I am trying to
draw up a graphing package that permits a user to vary the entries in the
legend box. I have had some success but have run into a problem concerning the
name of a data series.
The following code refers to a simple xy chart consisting of two data points
joined by a line. The original series name "01-Jan-06" is a date formatted
as "dd-mmm-yy". It is stored in a cell on worksheet(1) and the series is named
by adding the name through the chart wizard. The first time the series below
is run, it correctly displays the name as "01-Jan-06". No real surprises
there! However, equating the name (as shown below) to d1 (which equals
"01-Feb-06"), even formatting it appropriately (as shown), indeed setting it
directly
equal to "01-Feb-06" results in the name of the series being "1-Feb-06" -
i.e. the leading zero is dropped. This is causing me considerable problems, so
if anyone does have any suggestions as how to restore the leading zero I would
be very grateful.
Once again, thanking you for your time and efforts
Sheets("Chart1").Select
MsgBox ("Name is ") & ActiveChart.SeriesCollection(1).Name
d1 = "01-Feb-06"
ActiveChart.SeriesCollection(1).Name = d1
MsgBox ("new name ") & ActiveChart.SeriesCollection(1).Name
ActiveChart.SeriesCollection(1).Name = Format(Worksheets(1).Cells(1, 6),
Format("dd-mmm-yy"))
MsgBox ("new name 2 ") & ActiveChart.SeriesCollection(1).Name