运行时错误'1004':对象'_global'的“cells”方法失败
numShips=7
ActiveChart.SetSourceData Source:=Sheets("Ship Tracker").Range(Cells(2,78),Cells(17, NumShips+80)),_
PlotBy:=xlColumns
为什么我收到此错误。感谢。
答案 0 :(得分:1)
试试这个(你没有指定Cells()
所属的表格):
NumShips = 7
With Sheets("Ship Tracker")
ActiveChart.SetSourceData Source:=.Range(.Cells(2, 78), .Cells(17, NumShips + 80)), PlotBy:=xlColumns
End With