Human_doing
Board Regular
- Joined
- Feb 16, 2011
- Messages
- 137
Hi all,
This VBA creates a chart on each worksheet in the workbook, can anyone please tell me how to change the background of the chart from gray to white and the color of series 2 from pink (the default for a second series I presume) to green? Also is there a list anywhere of all chart properties that you can change using .chart?
This VBA creates a chart on each worksheet in the workbook, can anyone please tell me how to change the background of the chart from gray to white and the color of series 2 from pink (the default for a second series I presume) to green? Also is there a list anywhere of all chart properties that you can change using .chart?
Code:
Sub ChartYearComparison()
Dim WS As Worksheet
Dim Rng As Range
Dim Rng1 As Range
For Each WS In Worksheets
Set Rng = WS.Range("A200:C213")
Set Rng1 = WS.Range("A11:L21")
With WS.ChartObjects.Add _
(Left:=Rng1.Left, Width:=Rng1.Width, Top:=Rng1.Top, Height:=Rng1.Height)
.Chart.SetSourceData Source:=WS.Range("A200:C213")
.Chart.ChartType = xlColumnClustered
.Chart.HasTitle = True
.Chart.ChartTitle.Characters.Text = WS.Range("A2") & " Occurences"
.Chart.SeriesCollection(2).ChartType = xlLine
End With
Next WS
End Sub