How do I place four chartobjects in a single Excel chartsheet with four ranges of data set?
I create all four charts in a chart sheet. I am struggling to resize the first chartobject since it looks like the chart size is fixed.
If I create a chart in a chart sheet, is it going to be the fixed size, fitting to the entire screen?
Also, I tried to select each chart using chart index, but the first chartobject doesn't have the index, resulting in getting only three index out of four chartobjects.
The code is not working since the second import chart will be index 1 which won't match to ForLoop index.
For i = 1 To cnt_dataset - 1
Range((Cells(data_array(i, 1), 21)), (Cells(data_array(i, 2), 22))).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.ApplyLayout (10)
ActiveChart.ChartGroups(1).HiLoLines.Select
Selection.Delete
If i = 1 Then
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Chart"
Else
ActiveChart.Location Where:=xlLocationAsObject, Name:="Chart"
ActiveSheet.ChartObjects(i).Activate
End If
With ActiveChart
.ChartTitle.Text = "Chart A"
.Axes(xlValue, xlPrimary).AxisTitle.Text = "y"
.Axes(xlCategory, xlPrimary).AxisTitle.Text = "x"
.Axes(xlCategory).Select
End With
Selection.TickLabels.NumberFormat = "#,##0"
ActiveWindow.WindowState = xlMaximized
Next i
resize
andreposition
a chart.. Also how toCoverRangeWithAChart
. Failing that you could "always record a macro to find out how to do something". – alowflyingpig