Geeting error while setting datalabels through VBA

S

Shilps

Hi,
I have this piece of code

ActiveSheet.ChartObjects("Chart 5").Activate
ab = ActiveChart.SeriesCollection(1).DataLabels.Count
Debug.Print "count", ab
lup = 10
With ActiveChart.SeriesCollection(1)
For a = 2 To ab
.DataLabels(a).Caption = Range("A" + CStr(lup)).Value
lup = lup + 1
Next
End With

It is giving RunTime error 1004 on line .DataLabels(a).Caption = Range("A"
+ CStr(lup)).Value

Whereas this code is running fine on all the other charts. Any clue why?

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top