Update data labels of a scatter plot chart after filtering

Cadorna

New Member
Joined
Jun 2, 2015
Messages
1
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!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,196,213
Messages
6,014,032
Members
441,801
Latest member
Aneurysm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top