Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Named range row copy/paste problem

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).Past e
I appreciate your help, -John

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Named range row copy/paste problem

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.

"John" wrote:

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).Past e
I appreciate your help, -John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy, Paste and Print Cells from a Named Range iperlovsky Excel Programming 3 August 6th 08 10:04 PM
Copy & Paste Named Range Contents BJ Excel Programming 8 August 1st 08 07:18 PM
After Copy and Paste, Add to an Existing Named Range Aria[_2_] Excel Programming 4 March 8th 07 12:53 AM
Copy and Paste 2 columns from a named range? Simon Lloyd[_735_] Excel Programming 2 May 28th 06 08:10 PM


All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"