Graph excel
Résolu/Fermé
A voir également:
- Graph excel
- Liste déroulante excel - Guide
- Formule excel - Guide
- Si et excel - Guide
- Aller à la ligne excel - Guide
- Mise en forme conditionnelle excel - Guide
2 réponses
Raymond PENTIER
Messages postés
58396
Date d'inscription
lundi 13 août 2007
Statut
Contributeur
Dernière intervention
25 avril 2024
17 094
23 sept. 2008 à 05:12
23 sept. 2008 à 05:12
NON.
Mais tu peux manuellement insérer des textes, que tu fais glisser au bon endroit ; mais c'est long, et au cas où les valeurs changent, il faur déplacer ces étiquettes une à une.
Mais tu peux manuellement insérer des textes, que tu fais glisser au bon endroit ; mais c'est long, et au cas où les valeurs changent, il faur déplacer ces étiquettes une à une.
Merci, mais exactement ce que je souhaite éviter ( plusieurs centaines d'adéquations à réaliser ... )
On m'a par ailleurs donné une solution macro qui j'espére pourra aider certains ...
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
ne me demandez pas d'explications, je sais que ca marche et ca me va !!!
On m'a par ailleurs donné une solution macro qui j'espére pourra aider certains ...
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
ne me demandez pas d'explications, je sais que ca marche et ca me va !!!