Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional select and paste


I have a range of data (C4:K6) named Data_1. I would like to create code
that will go through this range (or any defined range) and copy the
first two rows of this data to two different rows on the sheet (let's
say these rows are defined by the range C85:K86 and named
Data_1_1st_2rows). However, I don't just need the data pasted to this
range. I need the entire frist two rows of Data_1 pasted into the rows
comprising Data_1_1st_2rows. Thanks.


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490366

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Conditional select and paste

Try:

Sub TransferData()
Dim r1 As Range, r2 As Range
Set r1 = Range("Data_1").Resize(2, Columns.Count)
Set r2 = Range("Data_1_1st_2Rows").Resize(2, Columns.Count)
r2.Value = r1.Value
End Sub

Regards,
Greg

"BrianDP1977" wrote:


I have a range of data (C4:K6) named Data_1. I would like to create code
that will go through this range (or any defined range) and copy the
first two rows of this data to two different rows on the sheet (let's
say these rows are defined by the range C85:K86 and named
Data_1_1st_2rows). However, I don't just need the data pasted to this
range. I need the entire frist two rows of Data_1 pasted into the rows
comprising Data_1_1st_2rows. Thanks.


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490366


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional select and paste


Doesn't seem to work. Here's how I have it posted:


Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r1 As Range, r2 As Range
Set r1 = Range("Ext_DP6_P1_all").Resize(2, Columns.Count)
Set r2 = Range("Trunc_DP6_P1").Resize(2, Columns.Count)
r2.Value = r1.Value
End Sub
--------------------


--
BrianDP1977
------------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...o&userid=29110
View this thread: http://www.excelforum.com/showthread...hreadid=490366

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Conditional select and paste

Sorry, I misread the range definitions. Try:

Sub TransferData()
Dim r1 As Range, r2 As Range
Set r1 = Range("Data_1").Resize(2).EntireRow
Set r2 = Range("Data_1_1st_2Rows").EntireRow
r2.Value = r1.Value
End Sub

Regards,
Greg


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional select and paste


That works great. Thank you very much

--
BrianDP197
-----------------------------------------------------------------------
BrianDP1977's Profile: http://www.excelforum.com/member.php...fo&userid=2911
View this thread: http://www.excelforum.com/showthread.php?threadid=49036

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
Macro to select, cut and paste Tom Excel Worksheet Functions 3 November 1st 08 04:07 PM
PASTE LINK option not available when I select PASTE SPECIAL to link an image in Excel to a Word document. tln Links and Linking in Excel 0 April 22nd 07 04:28 PM
Not using select for copy and paste damorrison Excel Discussion (Misc queries) 2 April 8th 07 08:41 PM
select and paste flow23 Excel Discussion (Misc queries) 1 November 9th 05 05:10 PM
Select All and copy and paste Ashok[_2_] Excel Programming 7 November 11th 03 03:46 AM


All times are GMT +1. The time now is 10:38 PM.

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

About Us

"It's about Microsoft Excel"