Here's a macro that draws a thick line connecting the points in series 1
of the active chart.
''' START THE CODE ---------------------------------------
Sub DrawALine()
Dim myCht As Chart
Dim mySrs As Series
Dim Npts As Integer, Ipts As Integer
Dim myBuilder As FreeformBuilder
Dim myShape As Shape
Dim Xnode As Double, Ynode As Double
Dim Xmin As Double, Xmax As Double
Dim Ymin As Double, Ymax As Double
Dim Xleft As Double, Ytop As Double
Dim Xwidth As Double, Yheight As Double
Set myCht = ActiveChart
Xleft = myCht.PlotArea.InsideLeft
Xwidth = myCht.PlotArea.InsideWidth
Ytop = myCht.PlotArea.InsideTop
Yheight = myCht.PlotArea.InsideHeight
Xmin = myCht.Axes(1).MinimumScale
Xmax = myCht.Axes(1).MaximumScale
Ymin = myCht.Axes(2).MinimumScale
Ymax = myCht.Axes(2).MaximumScale
Set mySrs = myCht.SeriesCollection(1)
Npts = mySrs.Points.Count
Xnode = Xleft + mySrs.XValues(1) * Xwidth / (Xmax - Xmin)
Ynode = Ytop + (Ymax - mySrs.Values(1)) * Yheight / (Ymax - Ymin)
Set myBuilder = myCht.Shapes.BuildFreeform(msoEditingAuto, Xnode, Ynode)
For Ipts = 2 To Npts
Xnode = Xleft + mySrs.XValues(Ipts) * Xwidth / (Xmax - Xmin)
Ynode = Ytop + (Ymax - mySrs.Values(Ipts)) * Yheight / (Ymax - Ymin)
myBuilder.AddNodes msoSegmentLine, msoEditingAuto, Xnode, Ynode
Next
Set myShape = myBuilder.ConvertToShape
With myShape
' USE YOUR FAVORITE COLOR HERE
.Line.ForeColor.SchemeColor = 12 ' BLUE
.Line.Weight = 6#
End With
End Sub
''' END THE CODE -----------------------------------------
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______
Greg said:
No, you can't enter a value in points, not even with VBA. You might consider
making a drawing object that overlies your data.
HTH, Greg