ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Chart Title color can't be duplicated (also series color) (https://www.excelbanter.com/excel-programming/445352-chart-title-color-cant-duplicated-also-series-color.html)

danny tang

Chart Title color can't be duplicated (also series color)
 
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


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com