Sub DataLabelsFromRange()
Dim Cht As Chart Dim i, ptcnt As Integer
Set Cht = ActiveSheet.ChartObjects(1).Chart On Error Resume Next Cht.SeriesCollection(1).ApplyDataLabels _ Type:=xlDataLabelsShowValue, _ AutoText:=True, _ LegendKey:=False ptcnt = Cht.SeriesCollection(1).Points.Count For i = 1 To ptcnt Cht.SeriesCollection(1).Points(i).DataLabel.Text = _ ActiveSheet.Cells(i + 1, 1).Value
Next i
End Sub
Note -
Column1 - Labels
Column2 - X Values
Column3 - Y Values
Create Scatter Plot with XY values first and then run the above piece of code.
Wednesday, August 12, 2009
Subscribe to:
Posts (Atom)