Sub AttachLabelsToPoints()
'--------d'aprés Microsoft kb213750
'--------Dimension variables.
Dim Counter As Integer, ChartName As String, xVals As String, Xvalcol As Integer, LabelCol As Integer, decalage As Integer
LabelCol = InputBox("indiquer le N° colonne des étiquettes", "XYlabeler", "1")
' -----Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
' -----Store the formula for the first series in "xVals".
' ************************************************
' ------ si plusieurs séries, adapter ci-dessous le numero de série
xVals = ActiveChart.SeriesCollection(1).Formula
' ***************************serie****************
' -----Extract the range for the data from xVals. ( ;o) on aurait pu utiliser Split)
xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1)
Do While Left(xVals, 1) = ","
xVals = Mid(xVals, 2)
Loop
' ----- pour calculer la position relative par rapport aux X
Xvalcol = Range(xVals).Column
decalage = LabelCol - Xvalcol
' -----Attach a label to each data point in the chart.
For Counter = 1 To Range(xVals).Cells.Count
' ********************serie************************
ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel =True
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text =Range(xVals).Cells(Counter, 1).Offset(0,decalage).Value
' ********************serie************************
Next Counter
End Sub