Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Mayyy la Simpatie.ro
| Femeie 23 ani Brasov cauta Barbat 23 - 60 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
The code below moves all labels for 1 series in my chart to a position way above the series, showing leader lines from the series to the labels.
Sub Chart_Labels_Position()
Dim h, x As Double Dim i, cnt As Integer
With ActiveSheet h = ActiveChart.PlotArea.Height x = h - (8 * h) / 10 cnt = ActiveChart.FullSeriesCollection(1).DataLabels.Count For i = 1 To cnt ActiveChart.FullSeriesCollection(1).Points(i).DataLabel.Top = x 'or you can write a number, like 35 Next i
End With End Sub |
Modificat de TRaP (acum 4 ani)
|
|
pus acum 4 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
After the line with cnt = ... I had to add the following 2 lines in order to center my labels first, then set their positions, so they are right above the data points.
ActiveChart.FullSeriesCollection(1).DataLabels.Select Selection.Position = xlLabelPositionAbove
|
|
pus acum 4 ani |
|
Mrrrr
AdMiN
Inregistrat: acum 17 ani
Postari: 2228
|
|
Modified the code so it takes into account multiple series:
Sub Chart_Labels_Position()
Dim h, x As Double Dim i, j, cnt As Integer
With ActiveSheet h = ActiveChart.PlotArea.Height x = h - (9 * h) / 10 For j = 1 To ActiveChart.SeriesCollection.count
cnt = ActiveChart.FullSeriesCollection(j).DataLabels.count 'ActiveChart.FullSeriesCollection(j).DataLabels.Select ' ENABLE IF NEEDED 'Selection.Position = xlLabelPositionAbove ' ENABLE IF NEEDED For i = 1 To cnt ActiveChart.FullSeriesCollection(j).Points(i).DataLabel.Top = x 'or you can write a number, like 35 Next i
Next j
End With End Sub |
_______________________________________
|
|
pus acum 4 ani |
|