Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through to stop on pie charts Daniel Bonallack[_2_] Excel Programming 1 July 13th 04 06:11 PM
Looping Through Charts Mike Waldron[_2_] Excel Programming 1 May 21st 04 06:21 PM
Looping Through Charts No Name Excel Programming 1 May 20th 04 10:36 PM
Looping through ComboBoxes in a worksheet TonyM Excel Programming 2 May 18th 04 01:48 PM
Looping checkboxes embedded in worksheet Theresa[_5_] Excel Programming 1 February 27th 04 04:41 AM


All times are GMT +1. The time now is 09:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"