ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Label Position - Above & Below (https://www.excelbanter.com/excel-programming/406811-label-position-above-below.html)

EE[_2_]

Label Position - Above & Below
 
Hi

I have a Line Chart with one series. I have added the labels to this
series. All labels start with B or S. I need all labels starting with
S to be above the line and alls tarting with B below the line.

Is it possible to create a macro that can do this?

The labels area all in a separte column and are a concatenation of
text (B or S) and some percentages.

Best
Prasad

Nigel[_2_]

Label Position - Above & Below
 
Try this as a starter .......

Sub PositionLabels()
Dim x As Integer
With ActiveSheet.ChartObjects("Chart 1").Activate
For x = 1 To 12
With ActiveChart.SeriesCollection(1).Points(x).DataLabe l
Select Case Left(.Text, 1)
Case Is = "S": .Position = xlLabelPositionAbove
Case Is = "B": .Position = xlLabelPositionBelow
Case Else: .Position = xlLabelPositionCenter
End Select
End With
Next
End With
End Sub

--

Regards,
Nigel




"EE" wrote in message
...
Hi

I have a Line Chart with one series. I have added the labels to this
series. All labels start with B or S. I need all labels starting with
S to be above the line and alls tarting with B below the line.

Is it possible to create a macro that can do this?

The labels area all in a separte column and are a concatenation of
text (B or S) and some percentages.

Best
Prasad




All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com