0

In VBA Excel I get an Automation Error the second time I run my code. It is as follows:

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

And it triggers the error in the line

Selection.Insert Shift:=xlDown

I researched and got to this link https://support.microsoft.com/en-us/help/178510/excel-automation-fails-second-time-code-runs but I don't get which is the object I am failing to call

Alvatroc
  • 13
  • 5
  • See [how to avoid Select](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros) and probably that will solve the problem. – David Zemens Jun 21 '17 at 15:56

1 Answers1

0

Without using Select, this should solve it I think:

With Sheets("Panel Resumen")
    .Rows("55:69").Copy
    .Rows("55:55").Insert Shift:=xlDown
End With
Application.CutCopyMode = False
David Zemens
  • 53,033
  • 11
  • 81
  • 130