Combine Multiple Excel worksheets into one VBA | Merge Multiple sheets

preview_player
Показать описание
Combine multiple SHEETS from a Workbook.

Code:
Sub Consolidate()

Dim LR, LC As Long
Dim sht As Worksheet
Dim wrk As Workbook

Set wrk = ActiveWorkbook

For Each sht In wrk.Worksheets
If sht.Name "Master" Then
sht.Select
LR = ActiveSheet.Range("A100000").End(xlUp).Row
LC = ActiveSheet.Range("XFD1").End(xlToLeft).Column
ActiveSheet.Range(Cells(2, 1), Cells(LR, LC)).Copy
Sheets("Master").Select
LR_M = ActiveSheet.Range("A100000").End(xlUp).Row + 1

Sheets("Master").Range("A" & LR_M).PasteSpecial (xlPasteValues)
End If

Next
End Sub
Рекомендации по теме
Комментарии
Автор

Very good video, I appreciate the step by step building of the code.

dansilecchia
Автор

Thank you my friend! This was very helpful!

josephpicariello-qu
Автор

This is informative video but please zoom to code while writing the codes show that one can see the piece of code

What if one have variable header in all sheets is it possible to combine all of them along with headers.

bhupendrakumar
Автор

Hi Sir can check with you what if the workbooks have several sheets but you only want to consolidate selected worksheets to the masterfiles?
example you ::: you have file like name of cars, name of place, apple, mango, pineapple, then the masters ...so you want to consolidate the fruits only files, how to ignore the other sheets by the VBA?

BartolomeCabrera
Автор

I have one real time problem can you help me solve them out.

bhupendrakumar
Автор

I want to copy and peast only last row
How can I do
Pls published a tutorial

raselzamadder
Автор

How to copy multiple sheet data into different workbook

isrinivasan