Filling Source Data Array with Decimal Values
Thanks, Kelly.
Before I saw your reply, I took a different approach. I added a new
series to the chart, formatted it as an XY chart on a secondary axis.
This series only had one Y value (the mean) and one X value (1). I set
the secondary Y to the same min and max as the primary secondary axis
and the min and max of the secondary X to 0 and 1. Then I added an X
Error Bar to the new data point set to a Minus Error with a fixed value
of 1. This drew the line across the chart. Now that it is set up, it
works pretty slick since it requires no VBA except to keep the Y axis
scales in synch and add the data label to the last point. Thanks for
your help. I tries several different paths to the final destination,
and as always, learned a great deal in the journey.
Here's the code I used for the scales.
Sub SetScales
' Set the min and max ranges of the Secondary Y axis to equal the X
axis
iMin = ActiveChart.Axes(xlValue, xlPrimary).MinimumScale
iMax = ActiveChart.Axes(xlValue, xlPrimary).MaximumScale
With ActiveChart.Axes(xlValue, xlSecondary)
.MinimumScale = iMin
.MaximumScale = iMax
End With
With ActiveChart.Axes(xlCategory, xlSecondary)
.MinimumScale = 0
.MaximumScale = 1
End With
End Sub
|