【问题标题】:Excel VBA Automation Error second time code runsExcel VBA自动化错误第二次代码运行
【发布时间】:2017-11-24 15:21:51
【问题描述】:

在 VBA Excel 中,我第二次运行代码时出现自动化错误。 如下:

Sheets("Panel Resumen").Select
Rows("55:69").Select
Selection.Copy
Rows("55:55").Select
Selection.Insert Shift:=xlDown
Range("D25").Select
Application.CutCopyMode = False

并且它触发了行中的错误

Selection.Insert Shift:=xlDown

我研究并找到了这个链接https://support.microsoft.com/en-us/help/178510/excel-automation-fails-second-time-code-runs 但我不知道哪个是我未能调用的对象

【问题讨论】:

标签: vba excel automation runtime-error


【解决方案1】:

不使用Select,我认为这应该可以解决:

With Sheets("Panel Resumen")
    .Rows("55:69").Copy
    .Rows("55:55").Insert Shift:=xlDown
End With
Application.CutCopyMode = False

【讨论】:

    猜你喜欢
    • 2015-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-07
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多