[算表] VBA 换列

楼主: Pettitte1   2021-07-08 13:46:42
软件:Excel
版本:Office 365
请问我想要做xy图表
A1、D1、G1、J1、M1...=图表名称
B1:B1400、E1:E1400、H1:H1400、K1:K1400...=x轴
C1:C1400、F1:F1400、I1:I1400、L1:L1400...=y轴
vba如下
Sub Chartxy()
Range("B1400:C1400").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Range("工作表1!$B$1:$C$1065")
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).Name = "=工作表1!$A$1"
Dim i As Integer
For i = 2 To 48
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Name = "=工作表1!$D$1"
ActiveChart.SeriesCollection(i).XValues = "=工作表1!$E$1:$E$1400"
ActiveChart.SeriesCollection(i).Values = "=工作表1!$F$1:$F$1400"
Next i
End Sub
请问如何把 工作表1! 改成像上述的递增
谢谢!
作者: soyoso (我是耀宗)   2021-07-08 14:30:00
range("b1:b1400").offset(,i*3).address
楼主: Pettitte1   2021-07-08 18:48:00
好像不用加.address也可用 thanks

Links booklink

Contact Us: admin [ a t ] ucptt.com