![]() |
Change fonts of chart legend - different results on 2 computers
Hi,
I try to set the font values of a chart legend. On my computer it works fine - on a second it does not do anything, without any error messages. My code: For i = 1 To [...].DataLabels.Count Worksheets(1).ChartObjects(1).Chart.SeriesCollecti on(1).DataLabels(i) _ .Font.Size = 50 Worksheets(1).ChartObjects(1).Chart.SeriesCollecti on(1).DataLabels(i) _ .Font.ColorIndex = 33 Next Does anybody see the problem with this code? In general, would it be better to reference the chart with the ActiveChart object? Are there problems with ActiveChart? Regards, Thomas |
Change fonts of chart legend - different results on 2 computers
Thomas -
Data labels are not the same thing as the legend. I hope that's not causing your troubles. If you have no data labels, you'll never go through the loop. The syntax looks okay. You have a choice of: ActiveChart.SeriesCollection(1).DataLabels(1).Font .Size = 36 ActiveChart.SeriesCollection(1).Points(1).DataLabe l.Font.Size = 36 The difference between ActiveChart and a more fully referenced chart depends on what you're doing. I used activechart here because it was less typing, but fully referenced code doesn't choke if you forget to select the chart first. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Thomas Wieser wrote: Hi, I try to set the font values of a chart legend. On my computer it works fine - on a second it does not do anything, without any error messages. My code: For i = 1 To [...].DataLabels.Count Worksheets(1).ChartObjects(1).Chart.SeriesCollecti on(1).DataLabels(i) _ .Font.Size = 50 Worksheets(1).ChartObjects(1).Chart.SeriesCollecti on(1).DataLabels(i) _ .Font.ColorIndex = 33 Next Does anybody see the problem with this code? In general, would it be better to reference the chart with the ActiveChart object? Are there problems with ActiveChart? Regards, Thomas |
All times are GMT +1. The time now is 10:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com