PC Review


Reply
Thread Tools Rate Thread

Copy Row 2 from Sheet1 & Paste to Row 10 Sheet2

 
 
RyGuy
Guest
Posts: n/a
 
      23rd Nov 2008
How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
blank, and if it is not blank, paste to the next blank row in Sheet2?

I have an idea of how to copy form 1 and paste to 2, in the first blank row
in 2:
Worksheets("Sheet1").Range("2:2").EntireRow.Copy
Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow

However, I can't figure out how to test if Sheet2, Row10 is blank, and if it
is blank, paste there, but if it is not blank, paste in the first blank row
on Sheet 2.

Regards,
Ryan---
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      23rd Nov 2008
Hi
Ryan

I'm a bit confused, do you want to paste to row 10 or 20 ? I assume
that it's row 10.

Try this

Sub move()
If Range("A10").Value = "" Then
TargetRow = 10
Else
TargetRow = Range("A" & Rows.Count).End(xlUp).Row + 1
End If
Worksheets("Sheet1").Rows(2).Copy Destination:=Worksheets
("Sheet2").Cells(TargetRow, "A")
End Sub


Regards,
Per


On 23 Nov., 06:14, RyGuy <Ry...@discussions.microsoft.com> wrote:
> How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
> blank, and if it is not blank, paste to the next blank row in Sheet2?
>
> I have an idea of how to copy form 1 and paste to 2, in the first blank row
> in 2:
> Worksheets("Sheet1").Range("2:2").EntireRow.Copy
> Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow
>
> However, I can't figure out how to test if Sheet2, Row10 is blank, and ifit
> is blank, paste there, but if it is not blank, paste in the first blank row
> on Sheet 2. *
>
> Regards,
> Ryan---


 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      23rd Nov 2008
maybe this:

application.count(worksheets("sheet2").rows(10)) = 0

--


Gary

"RyGuy" <(E-Mail Removed)> wrote in message
news:3939F92C-15B5-433E-9D20-(E-Mail Removed)...
> How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
> blank, and if it is not blank, paste to the next blank row in Sheet2?
>
> I have an idea of how to copy form 1 and paste to 2, in the first blank row
> in 2:
> Worksheets("Sheet1").Range("2:2").EntireRow.Copy
> Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow
>
> However, I can't figure out how to test if Sheet2, Row10 is blank, and if it
> is blank, paste there, but if it is not blank, paste in the first blank row
> on Sheet 2.
>
> Regards,
> Ryan---



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      23rd Nov 2008
One way:

Dim rDest As Range

With Worksheets("Sheet2")
If Application.CountA(.Rows(20).Cells) = 0 Then
Set rDest = .Rows(10)
Else
Set rDest = _
.Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow
End If
Worksheets("Sheet1").Range("2:2").EntireRow.Copy Destination:=rDest
End With

In article <3939F92C-15B5-433E-9D20-(E-Mail Removed)>,
RyGuy <(E-Mail Removed)> wrote:

> How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
> blank, and if it is not blank, paste to the next blank row in Sheet2?
>
> I have an idea of how to copy form 1 and paste to 2, in the first blank row
> in 2:
> Worksheets("Sheet1").Range("2:2").EntireRow.Copy
> Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow
>
> However, I can't figure out how to test if Sheet2, Row10 is blank, and if it
> is blank, paste there, but if it is not blank, paste in the first blank row
> on Sheet 2.

 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      23rd Nov 2008
for the a

application.counta(worksheets("sheet2").rows(10)) = 0

--


Gary

"Gary Keramidas" <GKeramidasAtMsn.com> wrote in message
news:(E-Mail Removed)...
> maybe this:
>
> application.count(worksheets("sheet2").rows(10)) = 0
>
> --
>
>
> Gary
>
> "RyGuy" <(E-Mail Removed)> wrote in message
> news:3939F92C-15B5-433E-9D20-(E-Mail Removed)...
>> How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
>> blank, and if it is not blank, paste to the next blank row in Sheet2?
>>
>> I have an idea of how to copy form 1 and paste to 2, in the first blank row
>> in 2:
>> Worksheets("Sheet1").Range("2:2").EntireRow.Copy
>> Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow
>>
>> However, I can't figure out how to test if Sheet2, Row10 is blank, and if it
>> is blank, paste there, but if it is not blank, paste in the first blank row
>> on Sheet 2.
>>
>> Regards,
>> Ryan---

>
>



 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      23rd Nov 2008
In spite of my (somewhat) sloppy description, you nailed it JE McGimpsey.
Thanks so much!!

Regards,
Ryan---


--
RyGuy


"JE McGimpsey" wrote:

> One way:
>
> Dim rDest As Range
>
> With Worksheets("Sheet2")
> If Application.CountA(.Rows(20).Cells) = 0 Then
> Set rDest = .Rows(10)
> Else
> Set rDest = _
> .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow
> End If
> Worksheets("Sheet1").Range("2:2").EntireRow.Copy Destination:=rDest
> End With
>
> In article <3939F92C-15B5-433E-9D20-(E-Mail Removed)>,
> RyGuy <(E-Mail Removed)> wrote:
>
> > How can I copy Row 2 from Sheet1 & paste to Row 10 Sheet2, if Sheet2 Row20 is
> > blank, and if it is not blank, paste to the next blank row in Sheet2?
> >
> > I have an idea of how to copy form 1 and paste to 2, in the first blank row
> > in 2:
> > Worksheets("Sheet1").Range("2:2").EntireRow.Copy
> > Worksheets("Sheet2").Range("A65536").End(xlUp)(2).EntireRow
> >
> > However, I can't figure out how to test if Sheet2, Row10 is blank, and if it
> > is blank, paste there, but if it is not blank, paste in the first blank row
> > on Sheet 2.

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy from sheet1 then paste special transpose to sheet2,3,4 Christine Microsoft Excel Misc 1 22nd Jul 2009 09:50 PM
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Microsoft Excel Misc 6 27th Feb 2009 09:48 PM
Macro to Copy data from a list in sheet1 and paste into sheet2 Michael Microsoft Excel Misc 3 23rd Apr 2008 06:52 PM
multiple search criteria to find and copy from sheet1 and paste into sheet2 lothario Microsoft Excel Programming 2 25th Nov 2003 09:57 AM
Search, find, copy from sheet1 and paste into sheet2 lothario Microsoft Excel Programming 4 9th Nov 2003 09:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 AM.