0

我在调试需要对象时收到运行时错误 424。有没有办法重写代码?我在线上遇到错误: ActiveSheet.Shapes("Chart 1").Left = Sheet1.Cells(1, 1).Left

ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Range("Sheet1!$A$3:$R$12")
ActiveSheet.Shapes("Chart 1").Height = 450
ActiveSheet.Shapes("Chart 1").Width = 950
ActiveChart.SetElement (msoElementLineDropLine)
ActiveSheet.Shapes("Chart 1").Left = Sheet1.Cells(1, 1).Left
ActiveSheet.Shapes("Chart 1").Top = Sheet1.Cells(2, 1).Top
4

1 回答 1

0

我通过尝试在这里找到的东西得到了答案:Excel VBA 运行时错误“424”:尝试复制文本框时需要对象

我将“Sheet1”的引用更改为“ActiveSheet”,它起作用了!

谢谢大家

于 2013-09-16T21:37:07.030 回答