Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to select, cut and paste | Excel Worksheet Functions | |||
PASTE LINK option not available when I select PASTE SPECIAL to link an image in Excel to a Word document. | Links and Linking in Excel | |||
Not using select for copy and paste | Excel Discussion (Misc queries) | |||
select and paste | Excel Discussion (Misc queries) | |||
Select All and copy and paste | Excel Programming |