Copy rows in one worksheet to another

fluffynicesheep

Board Regular
Joined
Oct 27, 2009
Messages
69
Hi,

I have a workbook that contains 2 sheets (Report and Report-Additional).

The data in the "report" tab could be made up of any number of rows, but each row will always go up to column EI.

The data in the "report-additional" tab could also be made up of any number of rows (and sometimes this tab could be completely blank), but again if there is data in it, it will end at column EI for each row.

What I need to do is copy all data in the "report-additional" tab from A2 to EI2 and any other subsequent rows below that have data in, to underneath the final used row in the "report" tab. If there is nothing in column A2 on the "additional-report" tab then it doesn't copy anything across.

Thanks for your help
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
How about

VBA Code:
Sub CopyRows()
    Dim rngA As Range
    With Sheets("Report-Additional")
        If .Range("A2") <> "" Then Sheets("Report").Range("A1").CurrentRegion.Offset(1).Copy .Range("A" & Rows.Count).End(xlUp).Offset(1)
    End With
End Sub
 
Upvote 0
Hi Yongle,

Almost there ... but the wrong way around!!

Your script has looked to see if the "Report-Additional" tab has something in A2 and then if so, it has copied row 2 of the "Report" tab underneath the last row in the "Report-Additional" tab.

What I actually need it to do is:

Look to see if the "Report-Additional" tab has something in A2 and then if so copy row 2 downward of the "Report-Additional" tab underneath the last row on the "Report" tab. .....

So everything appears on the "Report" tab - your script pues everything on the "Report-Additional" tab.

I hope this makes sense!
 
Upvote 0
In that case ...
VBA Code:
    Dim rngA As Range
    With Sheets("Report-Additional")
        If .Range("A2") <> "" Then .Range("A1").CurrentRegion.Offset(1).Copy Sheets("Report").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top