Hi,
I want to create charts in Excel and I have different matrices (ranges).
Range("K2:P14") .Select
Charts.Add
ActiveChart.Cha rtType = xlLineMarkers
ActiveChart.Set SourceData Source:=Sheets( "Plan2").Range( "K2:P14")
ActiveChart.Loc ation Where:=xlLocati onAsObject, Name:="Plan2"
ActiveChart.Plo tArea.Select
ActiveChart.Ser iesCollection(1 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(2 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(3 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(4 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(5 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(6 ).XValues = "=Plan2!R3C10:R 16C10"
With ActiveChart
.HasTitle = True
.ChartTitle.Cha racters.Text = "Geral"
End With
That´s the routine to create one chart, but I need to create a lot more (using the command for next). To work with "for", I need to use Cells( i , j ).
I´ve tried Range(Cells(x,x ) , Cells(y,y)).
Example:
ActiveChart.Set SourceData Source:=Plan2.R ange(Cells(j * 15 + 2, colun + 2), Cells(j * 15 + 14, colun + anos + 1))
But that doesn´t work, it´s not looping.
Anyone can help?
I want to create charts in Excel and I have different matrices (ranges).
Range("K2:P14") .Select
Charts.Add
ActiveChart.Cha rtType = xlLineMarkers
ActiveChart.Set SourceData Source:=Sheets( "Plan2").Range( "K2:P14")
ActiveChart.Loc ation Where:=xlLocati onAsObject, Name:="Plan2"
ActiveChart.Plo tArea.Select
ActiveChart.Ser iesCollection(1 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(2 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(3 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(4 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(5 ).XValues = "=Plan2!R3C10:R 16C10"
ActiveChart.Ser iesCollection(6 ).XValues = "=Plan2!R3C10:R 16C10"
With ActiveChart
.HasTitle = True
.ChartTitle.Cha racters.Text = "Geral"
End With
That´s the routine to create one chart, but I need to create a lot more (using the command for next). To work with "for", I need to use Cells( i , j ).
I´ve tried Range(Cells(x,x ) , Cells(y,y)).
Example:
ActiveChart.Set SourceData Source:=Plan2.R ange(Cells(j * 15 + 2, colun + 2), Cells(j * 15 + 14, colun + anos + 1))
But that doesn´t work, it´s not looping.
Anyone can help?