在Excel中使用宏绘制多个数据系列

时间:2017-04-15 06:24:37

标签: excel-vba vba excel

这是我的代码:

Dim i As Integer
Dim names1 As String
Dim names2 As String
Dim names3 As String


ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmooth).Select
For i = 1 To 1

    names1 = Cells(2, i + 1).Address
    names2 = Range(Cells(3, i), Cells(85, i)).Address
    names3 = Range(Cells(3, i + 1), Cells(85, i + 1)).Address

    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.FullSeriesCollection(1).Name = "=Sheet3!" & names1
    ActiveChart.FullSeriesCollection(1).XValues = "=Sheet3!" & names2
    ActiveChart.FullSeriesCollection(1).Values = "=Sheet3!" & names3

Next i

X值在列#34; I" ,Y值在列#34; I + 1" 现在我想在每个循环中它删除现有的绘图并绘制新的绘图。那么我应该添加什么才能将图形叠加在一起呢?

1 个答案:

答案 0 :(得分:2)

尝试下面的代码(代码注释中的解释):

Beginning configuration step: Stopping Server [if necessary]
Ended configuration step: Stopping Server [if necessary]

Beginning configuration step: Writing configuration file
Ended configuration step: Writing configuration file

Beginning configuration step: Updating firewall
Adding firewall rule for MySQL57 on port 3306.
Successfully added firewall rule.
Ended configuration step: Updating firewall

Beginning configuration step: Adjusting Windows service [if necessary]
Attempting to grant Network Service require filesystem permissions.
Granted permissions.
Adding new service
New service added
Ended configuration step: Adjusting Windows service [if necessary]

Beginning configuration step: Initializing Database [if necessary]
Deleting Data folder shipped
Attempting to run MySQL Server with --Initialize-insecure
Running process: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console
Waiting for the server stops: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console
2017-04-15T06:26:24.188171Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-15T06:26:24.188171Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-04-15T06:26:29.144031Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-04-15T06:26:29.946540Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-15T06:26:30.159610Z 0 [ERROR] unknown variable 'innodbclustertypeselection=0.0'
2017-04-15T06:26:30.160610Z 0 [ERROR] Aborting

The attempt to initialize the database Failed
Ended configuration step: Initializing Database [if necessary]

Beginning configuration step: Starting Server
Starting MySQL as a service