Automation · VBA
Combine All Sheets
Merge every worksheet into one master sheet.
- Creates a Combined sheet
- Keeps the header once
- Appends data from all sheets
' Combines all worksheets into a single "Combined" sheet (assumes a header row on each).
Sub CombineAllSheets()
Dim ws As Worksheet, master As Worksheet
Dim lastRow As Long, destRow As Long
Application.ScreenUpdating = False
On Error Resume Next
Application.DisplayAlerts = False
ThisWorkbook.Sheets("Combined").Delete
Application.DisplayAlerts = True
On Error GoTo 0
Set master = ThisWorkbook.Sheets.Add
master.Name = "Combined"
destRow = 1
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Combined" Then
lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
If destRow = 1 Then
ws.Rows(1).Copy master.Rows(1)
destRow = 2
End If
If lastRow > 1 Then
ws.Range(ws.Rows(2), ws.Rows(lastRow)).Copy master.Cells(destRow, 1)
destRow = destRow + (lastRow - 1)
End If
End If
Next ws
Application.ScreenUpdating = True
MsgBox "Combined " & (destRow - 1) & " rows.", vbInformation
End Sub
Free to use and modify · ExcelBot — excelempowers.com
Copies the rows of every worksheet (sharing the same header) into a single "Combined" sheet.
How to install:
- Open your workbook and press Alt + F11 to open the VBA editor.
- Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
- Press F5 to run, or run it from Developer ▸ Macros.
- Save your file as .xlsm (macro-enabled) to keep the macro.
No VBA? In ExcelBot you can do the same thing by just asking the AI in plain language.
combine sheets
merge
consolidate
unir hojas
consolidar
Rather not use VBA?
In ExcelBot you get the same result by asking the AI in plain language — no macros needed.
Try ExcelBot free Browse more macros