Link to home
Start Free TrialLog in
Avatar of Steve Lowry
Steve LowryFlag for United States of America

asked on

How to merge varying numbers of rows from two worksheets to appear on a single worksheet with a blank row to separate the data?

After running a macro to query a database that changes daily, I get two worksheets with formatted reports that may randomly vary between 10 and 15 rows each day.  

I would like to copy the rows from Sheet1, and paste it below the last row of data on Sheet2, leaving a blank row between the two reports.  I would add this code at the end of the macro to generate the merged report.
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is a one line of code. On my screen it is showing as two lines.
Maybe better to have
With Sheet1
    .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp)).Copy Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(2)
End With

Open in new window

Avatar of Steve Lowry


This works great.  Thanks for your help today.