2
我想根據已有的一些信息爲每張圖表添加一個新圖表。不過,我最後只能在最後一張信息的圖表上留下一張表格。我認爲這些圖表正在覆蓋自己。每張圖表都有一個新圖表
下面的代碼
Dim chart1 As chart
Set chart1 = Charts.Add
For i = 0 To 9
chart1.Add.SetSourceData Source:=Destino.Range("A24").Offset(0, 3 * i).CurrentRegion, PlotBy:=xlRows
chart1.ChartType = xlBarClustered
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="gráfico" & i + 1
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Cuenta por categoría de" & origen.[c4].Offset(i, 0)
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Categoría"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Frecuencia"
End With
ActiveSheet.Move After:=Sheets(ActiveWorkbook.Sheets.Count)
Next