Run-time error: Unable to get the count property of the DataLabels class

TheWildAfrican

Board Regular
Joined
Apr 23, 2013
Messages
70
Dear All:

I'm getting a run-time error each time I tried to execute the code below.

objChart.SeriesCollection(1).DataLabels.Font.Size = 7

objChart.SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
False, ShowSeriesName:=False, ShowCategoryName:=False, ShowValue:=False, _
ShowPercentage:=False, ShowBubbleSize:=False

Has anyone encountered the bug before?

Thanks for your anticipated help.

Best,

TheWildAfrican
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Re: Run-time errpr: Unabble to get the count property of the DataLabels class

You'll need to apply the data labels before you trying setting the font size. Also, your code disables each label option. So no data labels will actually be applied.
 
Upvote 0
Re: Run-time errpr: Unabble to get the count property of the DataLabels class

Thanks Domenic Tamburino. Your response is much appreciated. So, if I place the lines below before setting the font, you think the code would work?

objChart.SeriesCollection(1).ApplyDataLabels AutoText:=True, LegendKey:= _
True, ShowSeriesName:=True, ShowCategoryName:=True, ShowValue:=True, _
ShowPercentage:=True, ShowBubbleSize:=True


You'll need to apply the data labels before you trying setting the font size. Also, your code disables each label option. So no data labels will actually be applied.
 
Upvote 0
Re: Run-time errpr: Unabble to get the count property of the DataLabels class

Which option or options do you want for your lables?
 
Upvote 0
Re: Run-time errpr: Unabble to get the count property of the DataLabels class

Thanks again for your response. First, I wanted to see if I'll get the run-time error. The error was fixed fixed after I applied the data label as you suggested. As for the options I'll like to use for the labels, I'll have to make some adjustments to see what looks best. Thanks again man!!

Which option or options do you want for your lables?
 
Upvote 0
Re: Run-time errpr: Unabble to get the count property of the DataLabels class

Sounds good. :-)

Cheers!
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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