Combine sheets - different size n shape

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,
i need help to combine two sheets in the same document by VBA scripts. My 2 worksheets have very similar format (same column numbers, same headings but the cells got different size and shapes).
I want to copy the data from sheet 5 to sheet 1, where the data obtained from sheet 5 should be placed right behind the data of sheet 1. The problem i came across is that since the cells got different shapes and size, excel could not do the copy and paste for me using vba scripts.

please take a look at the reference file.
https://authentification.site/files/23654475/hoho.xls

I want to add the data in sheet 5 to sheet 1(after the last filled row in sheet 1). sheet 3 is my target, but i would like the real output to be placed in sheet 1.


Also, please find macro 1 in the file, which is the scripts i used to perform the job. i did a similar job before (when all the cells got same size and shape), the codes work, but not this time...

Please help. Thanks


1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Copy what range to what range? by range i mean copy what columns to what column
Copy range E to AK from sheet 5( without the headings -row 1 & 2) and paste the data right below the last row of data in sheet 1(also, range E to AK) . Thanks
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Change this part of your macro
If (lTgtLastRow = 1) Then
Rows("1:" & lSrcMaxRows).Copy
Else
Rows("2:" & lSrcMaxRows).Copy
End If

Make it to copy the range that you would like to copy. This copy the rows

And change this Cells(lTgtLastRow, "A").PasteSpecial
This start pasting at column A. Change it to E