excel VBA - Combine sheets together (Append to bottom)

Hi,

I have 4 sheets with the same number of columns but a dynamic number of rows.

I want to add 'sheet 2' 'sheet 3' and 'sheet 4' to the bottom of 'sheet 1'.

Is there an easy way to achieve this in VBA?
mhdiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
Something like

sheet2.range("A1:D" & range("A" & rows.count).end(xlup).row).copy sheet1.range("A" & rows.count).end(xlup).offset(1)
sheet3.range("A1:D" & range("A" & rows.count).end(xlup).row).copy sheet1.range("A" & rows.count).end(xlup).offset(1)
sheet4.range("A1:D" & range("A" & rows.count).end(xlup).row).copy sheet1.range("A" & rows.count).end(xlup).offset(1)


Change the D in A1:D to the last column you have
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mhdiAuthor Commented:
Thanks, that almost works. Its just not counting the rows the source sheets correctly.

Im trying to work out why, but at the moment it seems to be random.
0
mhdiAuthor Commented:
Fixed it. I had to specifically reference the sheets.

eg:
sheet2.range("A" & sheet2.rows.count)
0
Saqib Husain, SyedEngineerCommented:
You are right. Sorry for that.

Saqib
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.