Named range row copy/paste problem

J

John

The last line of this code, the paste line, errors out. Both named ranges are
identically formated cols B-H on two different sheets, but the ranges have
different numbers of rows. I'm trying to a copy a selected row from
NamedRange1 to the second row of NamedRange2.
Application.CutCopyMode = False
Sheets("Sheet1").Range("NamedRange1").Rows(j).Copy
Sheets("Sheet2").Select
Sheets("Sheet2").Range("NamedRange2").Rows(2).Paste
I appreciate your help, -John
 
J

JLGWhiz

You do not need to select sheet 2 if you use the direct copy method. This
would normally all be on one line of code. The sibscript line attenuator
makes the two lines below behave as one.

Sheets("Sheet1").Range("NamedRange1").Rows(j).Copy _
Sheets("Sheet2").Range("NamedRange2").Rows(2)

The syntax you were using for Paste will not work with the Rows collection
object.
You would have to use PasteSpecial with arguments to make it work that way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top