百科知识

Excelvba警告信息我编了一个VBA程序,先运行第一个过程,

2008-05-09 20:39:42s***
我编了一个VBA程序,先运行第一个过程,然后运行第二个过程.在运行第二个过程时会弹出系统提示信息,请问如何阻止该信息的弹出? Sub inputData() Dim i As Integer Dim j As Integer Dim k As Integer Dim m As Integer i = 0 j = 0 k = 1 m = 1 For j = 1 To 5 Step 1 For i = 1 To 50 Step 1 Sheets("sheet1").Cells(i, 2 * j - 1) = i Sheets("sheet1").Cells(i, 2 * j) = i * i / m + k Next k = k + 10 m = m + 1 Next End Sub Sub try() Dim i As Integer Dim j As Integer Dim X(7) As Range Dim Y(7) As Range Dim mySource As Range i = 0 j = 0 With ActiveWorkbook.Sheets("sheet1") Set X(0) = Sheets("sheet1").Columns(1) Set Y(0) = Sheets("sheet1").Columns(2) Set mySource = Union(X(0), Y(0)) Charts.Add ActiveChart.ChartType = xlXYScatterSmooth ActiveChart.SetSourceData Source:=mySource For i = 2 To 5 Step 1 Set X(1) = .Columns(2 * i - 1) Set Y(1) = .Columns(2 * i) Charts(1).Activate ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(i).XValues = X(1) ActiveChart.SeriesCollection(i).Values = Y(1) Next i End With End SubExcelvba警告信息我编了一个VBA程序,先运行第一个过程,然后运行第二个过程.在运行第二个过程时会弹出系统提示信息,请问如何阻止该信息的弹出?Subinp?

最佳回答

  • 从您的程序清单上看没有问题,而且我也运行了几次,并没有出现你说的警告信息,请你把出现的警告信息,告诉我们吧。
    2008-05-09 21:22:44
  • 运用用出错时继续执行语句。 在第一行先写 ONERROR RESUME NEXT
    2008-05-12 10:56:45
  • 很赞哦! (13)