Bonjour,

Je voudrais ajouter des labels personnalises a mon nuage de point. J ai trouve le code sur internet mais malheuresement je n arrive pas a changer le numero de la colonne auquelle je veux que les labels soient rattaches.

voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Sub AttachLabelsToPoints()
 
   'Dimension variables.
   Dim Counter As Integer, ChartName As String, xVals As String
 
   ' Disable screen updating while the subroutine is run.
   Application.ScreenUpdating = False
 
   'Store the formula for the first series in "xVals".
   xVals = ActiveChart.SeriesCollection(1).Formula
 
   'Extract the range for the data from xVals.
   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
 
   'Attach a label to each data point in the chart.
   For Counter = 1 To Range(xVals).Cells.Count
     ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _
         True
      ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
         Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
   Next Counter
 
End Sub
Mes collonnes sont presentees comme suit : avec X = Rating Num et Y = YTB Je voudrais ajouter la colonne Instrument Name dans mes Labels

ISIN | InstrumentName | Old weight | YTB | Sector | Rating | Rating num |

Merci pour votre aide