Looping through charts in a worksheet
Hi there, I am sorting of blundering through this. I am
trying to get the following working: For Each chtObj In ActiveSheet ActiveSheet.ChartObjects(chtObj).Activate 'Make the data labels bold ActiveChart.SeriesCollection(1).DataLabels.Select Selection.Font.Bold = True 'Update the bars to a different colour ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 37 .Pattern = xlSolid End With Next chtObj Any help appreciated, Grant. |
Looping through charts in a worksheet
Hi Grant,
Try this modified code, Sub X() Dim chtObj As ChartObject For Each chtObj In ActiveSheet.ChartObjects With chtObj.Chart 'Make the data labels bold If .SeriesCollection(1).HasDataLabels Then .SeriesCollection(1).DataLabels.Font.Bold = True End If 'Update the bars to a different colour With .SeriesCollection(1) With .Border .Weight = xlThin .LineStyle = xlAutomatic End With .Shadow = False .InvertIfNegative = False With .Interior .ColorIndex = 37 .Pattern = xlSolid End With End With End With Next chtObj End Sub Cheers Andy Grant wrote: Hi there, I am sorting of blundering through this. I am trying to get the following working: For Each chtObj In ActiveSheet ActiveSheet.ChartObjects(chtObj).Activate 'Make the data labels bold ActiveChart.SeriesCollection(1).DataLabels.Select Selection.Font.Bold = True 'Update the bars to a different colour ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False Selection.InvertIfNegative = False With Selection.Interior .ColorIndex = 37 .Pattern = xlSolid End With Next chtObj Any help appreciated, Grant. -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
All times are GMT +1. The time now is 10:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com