Excel 在布尔vba中重命名图表
你好吗? 有人能帮我吗 我有以下生成图形的代码:Excel 在布尔vba中重命名图表,excel,vba,excel-charts,Excel,Vba,Excel Charts,你好吗? 有人能帮我吗 我有以下生成图形的代码: Sheets("kips").Select Dim i As Integer 'rows Dim j As Integer 'columns i = Cells(Rows.Count, 1).End(xlUp).Row For j = 2 To 5 With ActiveSheet.Shapes.AddChart.Chart .Cha
Sheets("kips").Select
Dim i As Integer 'rows
Dim j As Integer 'columns
i = Cells(Rows.Count, 1).End(xlUp).Row
For j = 2 To 5
With ActiveSheet.Shapes.AddChart.Chart
.ChartType = xlColumnClustered
.SeriesCollection.NewSeries
With .SeriesCollection(1)
'.Name = "=" & ActiveSheet.Name & "!" & _
'Cells(1, j).Address
.XValues = "=" & ActiveSheet.Name & "!" & _
Range(Cells(2, 1), Cells(i, 1)).Address
.Values = "=" & ActiveSheet.Name & "!" & _
Range(Cells(2, j), Cells(i, j)).Address
End With
End With
Next j
它工作得很好,但我需要创建这4个图形,并给出一个名称,因为它创建并使用带有“图形编号X”的东西,而其余代码不起作用,因为我一创建它就给它起了一个名称,他
下面是代码的其余部分
'Clean the charts
'chart1
ActiveSheet.ChartObjects("Gráfico 12").Activate
ActiveChart.ChartTitle.Select
Selection.Delete
ActiveSheet.ChartObjects("Gráfico 12").Activate
ActiveChart.Axes(xlValue).MajorGridlines.Select
Selection.Delete
ActiveSheet.ChartObjects("Gráfico 12").Activate
ActiveChart.Axes(xlValue).Select
Selection.Delete
ActiveSheet.ChartObjects("Gráfico 12").Activate
ActiveChart.Legend.Select
Selection.Delete
ActiveSheet.ChartObjects("Gráfico 12").Activate
ActiveChart.FullSeriesCollection(1).Select
ActiveChart.ChartGroups(1).Overlap = -27
ActiveChart.ChartGroups(1).GapWidth = 50
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 32, 96)
.Transparency = 0
.Solid
End With
j=2到5的
使用ActiveSheet.Shapes.AddChart.Chart
.Parent.Name=“图表和(j-1)”