logo
Office Merge Multiple Excel Worksheets into One Worksheet

Merge Multiple Excel Worksheets into One Worksheet Through VBA

By Sophia | Last Updated

Many office men may need to merge multiple Excel Worksheets into a single master worksheet if they want to analyze or count the data quickly and easily. Sometimes they could merge the worksheets manually, but if there are numerous worksheets, merging sheets manually would be time-consuming. Now I would introduce merging multiple Excel Worksheet to One Worksheet through VBA.

Now we suppose that you have three Worksheets contains some information about the students and now you would like to merge them into a Worksheet. Please follow the under steps if you are interested in learning merging multiple Excel Worksheet to one Worksheet through VBA.

multiple sheets in excel

Step 1: Press the ALT + F11 keys at same time to open the Microsoft Visual Basic for Applications window.

ms vba for apply

Step 2: Click Insert>>Module, then paste the under codes into the newly opened module.

Sub Combine()
Dim Sun As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
For Sun = 2 To Sheets.Count
Sheets(Sun).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub

Attention: If your sheet contains numerous columns of data, just set the Range in the last part of the code as big as possible.

type merging code for sheet in vba

Step 3: Press F5 or click the run icon run icon in vba in the toolbar. Then you would see there is a new sheet called Combined appearing in the Excel sheet line.

merging result in excel

Related Articles: