Home » excel » vba – Copy rows from different worksheets

vba – Copy rows from different worksheets

Posted by: admin May 14, 2020 Leave a comment

Questions:

How can I copy multiple rows in a worksheet and paste them further down, including any formatting like background colors and all the values already in the rows?

I tried using this snippet

Application.Worksheets("IPL").Select
Rows("6:9").Select
Application.CutCopyMode = False
Selection.Copy
Application.Worksheets("CMM").Select
Rows("13:13").Select
Selection.Insert Shift:=xlDown

But when I try to execute this, I get an application error. I tried some other examples but they don’t seem to do the same what I want…

Any help?

How to&Answers:

I simplified your code (the recorder’s code is always full of unnecessary “selects”) and it works fine, even across sheets !

Sheet1.Rows("5:6").Cut
Sheet2.Rows("18:19").Insert Shift:=xlDown