Как показано ниже, мои коды состоят из большого количества активных диаграмм, из-за которых моя программа глючит. Поскольку мне нужно создать по 1 диаграмме для каждого листа, как мне избежать использования activechart и перейти на что-то другое?
Private Sub addgraph_Vramp3()
Application.ScreenUpdating = False
Dim i As Long
Dim wz As Workbook
Set wz = ActiveWorkbook
Dim wsz As Worksheet
Set wsz = wz.Worksheets("current3")
wsz.Activate
wsz.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=wsz.Range("A1:BQ701")
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.Axes(xlValue).ScaleType = xlLogarithmic
ActiveChart.Axes(xlValue).MaximumScale = 0.001
ActiveChart.Axes(xlValue).MinimumScale = 0.000000000000001
ActiveChart.Axes(xlValue).TickLabels.NumberFormat = "0.00E+00"
ActiveChart.Axes(xlCategory).CrossesAt = 0
ActiveChart.Axes(xlCategory).MinimumScale = 0
ActiveChart.Axes(xlValue).TickLabels.NumberFormat = "0.E+00"
ActiveChart.SeriesCollection(1).Name = "='current'!$B$1"
For i = 2 To totalsample3 Step 1
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = wsz.Range(Cells(2, 2 * i - 1), wsz.Cells(myarray(i + 1), 2 * i - 1))
ActiveChart.SeriesCollection(i).Values = wsz.Range(Cells(2, 2 * i), wsz.Cells(myarray(i + 1), 2 * i))
ActiveChart.SeriesCollection(i).Name = wsz.Cells(1, 2 * i)
Next i
With ActiveChart
.Legend.Delete
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Voltage"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Current"
End With
' if TDDB, change to Time. ' if TDDB, change to logscale.
If testitem = True Then
ActiveChart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time(Seconds)"
ActiveChart.Axes(xlCategory).ScaleType = xlLogarithmic
Else
End If