F.P
F.P

Reputation: 17831

Copy rows from different worksheets

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?

Upvotes: 1

Views: 345

Answers (1)

iDevlop
iDevlop

Reputation: 25272

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

Upvotes: 3

Related Questions