I made a script to generate a new chart, according to the defined color parameters and cells of a column, according to lines containing value in cellule.
The Function Contalinhas serves to detect where there are cells with values, to
delimit the chart data:
Function ContaLinhas(area As Range) As Long
Dim celula As Range, TotalLinhas As Long
TotalLinhas = 0
For Each celula In area
If celula <> "" Then
TotalLinhas = TotalLinhas + 1
End If
Next
ContaLinhas = TotalLinhas
End Function
Here I have the Range and the Colors of the defined graphics
Sub NovoGrafico()
'Os dados estão contidos na coluna "A" (apenas como exemplo)
C = ContaLinhas(Range("A:A"))
'Cria um novo grafico com os parametros a serem definidos
ActiveSheet.ChartObjects("Superar").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = Range(Cells(2, 2), Cells(C, 2))
ActiveChart.SeriesCollection(1).XValues = Range(Cells(2, 1), Cells(C, 1))
ActiveChart.SeriesCollection(1).Interior.Color = RGB(255, 255, 255)
ActiveChart.SeriesCollection(1).Border.Color = RGB(0, 0, 0)
End Sub
That is to say,
I have a script that creates a new graphic with the colors White and Black, respectively, Interior and borders.