PC Review


Reply
Thread Tools Rate Thread

Chart Title color can't be duplicated (also series color)

 
 
danny tang
Guest
Posts: n/a
 
      9th Feb 2012
Hi,

[for Excel 2010]
i tried to record the properties of selected chart and duplicate to other charts in sheet.
however, the applied color is not match is selected chart. Any solutions and why? Thanks.


Sub MyChartFormat()

Application.ScreenUpdating = False
Dim Cnt As Long
Dim Arr_ChtPer()

Cnt = ActiveSheet.ChartObjects.Count

'Recording

ReDim Arr_ChtPer(110)

'ChartTitle

ActiveChart.ChartTitle.Select
With Selection
Arr_ChtPer(1) = .Left
Arr_ChtPer(2) = .Top
End With

With Selection.Format.TextFrame2.TextRange.Font
Arr_ChtPer(3) = .NameComplexScript
Arr_ChtPer(4) = .NameFarEast
Arr_ChtPer(5) = .Name
Arr_ChtPer(6) = .Size
Arr_ChtPer(7) = .Bold
End With

With Selection.Format.TextFrame2.TextRange.Font.Fill
Arr_ChtPer(8) = .Visible
Arr_ChtPer(9) = .ForeColor.ObjectThemeColor
Arr_ChtPer(10) = .ForeColor.TintAndShade
Arr_ChtPer(11) = .ForeColor.Brightness
Arr_ChtPer(12) = .ForeColor.RGB = RGB(255, 0, 0)
Arr_ChtPer(13) = .Transparency
End With

With Selection.Format.Fill
Arr_ChtPer(14) = .Visible
Arr_ChtPer(15) = .ForeColor.RGB
Arr_ChtPer(16) = .Transparency
End With


'Duplicating
i = 1
Do Until i > Cnt

ActiveSheet.ChartObjects(i).Activate

ActiveChart.ChartTitle.Select
With Selection
.Left = Arr_ChtPer(1)
.Top = Arr_ChtPer(2)
End With

With Selection.Format.TextFrame2.TextRange.Font
.NameComplexScript = Arr_ChtPer(3)
.NameFarEast = Arr_ChtPer(4)
.Name = Arr_ChtPer(5)
.Size = Arr_ChtPer(6)
.Bold = Arr_ChtPer(7)
End With

With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = Arr_ChtPer(8)
If Arr_ChtPer(8) <> -1 Then .ForeColor.ObjectThemeColor = Arr_ChtPer(9)
.ForeColor.TintAndShade = Arr_ChtPer(10)
.ForeColor.Brightness = Arr_ChtPer(11)
.ForeColor.RGB = Arr_ChtPer(12)
.Transparency = Arr_ChtPer(13)
End With

With Selection.Format.Fill
.Visible = Arr_ChtPer(14)
.ForeColor.RGB = Arr_ChtPer(15)
.Transparency = Arr_ChtPer(16)
End With

i = i + 1
Loop

end sub


br
Danny
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.