View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Shilps[_2_] Shilps[_2_] is offline
external usenet poster
 
Posts: 18
Default Geeting error while setting datalabels through VBA

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