VBA Macro For Merging Worksheets
Here is a three-step guide to combine all the data of all the sheets to single sheet. Follow these steps as mention: -1. Press ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window or you can open Microsoft Visual Basic window from developer tab >>Macros (in Code Group) as shown picture. (step by step guide about to add developer tab Click here).
2. Copy the following VBA and Click Insert > Module, and paste the following code in the Module Window.
Dim J As Integer
On Error Resume Next
Sheets(1).Name = "Combined"
For J = 2 To Sheets.Count
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
3. Now press F5 key to run this code, and it’s all done. A new worksheet named Combined has been created in which all the data from all the worksheets in the workbook has been merged and this worksheet will add before all worksheets.
- Your data must start from A1, if not, the code will not take effect.
- Your data must have the same structure.
- This code only can combine all worksheets of the active workbook, if you want to merge worksheets from multiple workbooks, <<< click here >>>
Dear readers, after reading the Content please ask for advice and to provide constructive feedback Please Write Relevant Comment with Polite Language.Your comments inspired me to continue blogging. Your opinion much more valuable to me. Thank you.