Hi,
I am currently assigning data labels to points in a scatterplot chart using the following code:
Application.ScreenUpdating = False
ActiveSheet.ChartObjects("ScatterPlot").Activate
'Range("A9") represent the first data label in the column where I have all my data labels
Set StartLabel = ActiveSheet.Range("A9")
For Each pt In ActiveChart.SeriesCollection(1).Points
pt.ApplyDataLabels xlDataLabelsShowValue
pt.DataLabel.Caption = StartLabel.Value
Set StartLabel = StartLabel.Offset(1)
Next
However, this code doesn't work properly when I am applying filters to the table to which the chart is linked.
For instance, if after filtering, only 10 points are displayed on the chart, the macro will assign the first 10 labels in my label list even though those labels are hidden by the filter.
Can you help?
Thank you very much for the attention!
I am currently assigning data labels to points in a scatterplot chart using the following code:
Application.ScreenUpdating = False
ActiveSheet.ChartObjects("ScatterPlot").Activate
'Range("A9") represent the first data label in the column where I have all my data labels
Set StartLabel = ActiveSheet.Range("A9")
For Each pt In ActiveChart.SeriesCollection(1).Points
pt.ApplyDataLabels xlDataLabelsShowValue
pt.DataLabel.Caption = StartLabel.Value
Set StartLabel = StartLabel.Offset(1)
Next
However, this code doesn't work properly when I am applying filters to the table to which the chart is linked.
For instance, if after filtering, only 10 points are displayed on the chart, the macro will assign the first 10 labels in my label list even though those labels are hidden by the filter.
Can you help?
Thank you very much for the attention!