Avatar of Steve Lowry
Steve Lowry
Flag 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.
Example-of-Merged-Reports.xlsx
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Steve Lowry

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Saqib Husain

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Saqib Husain

This is a one line of code. On my screen it is showing as two lines.
Saqib Husain

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



Steve Lowry

ASKER
This works great.  Thanks for your help today.

Steve
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23