Code to amalgamate rows from diff. worksheets into single worksheet ?

Maverick27

Active Member
Joined
Sep 23, 2010
Messages
329
Office Version
  1. 2013
Platform
  1. Windows
Hi - i have rows of data in different worksheets (same workbook) which i would like to amalgamate into a single worksheet.

It will save time in copying & pasting.

Any one care to share code to accomplish this.

Thanks in Advance.;)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi - i have rows of data in different worksheets (same workbook) which i would like to amalgamate into a single worksheet.

It will save time in copying & pasting.

Any one care to share code to accomplish this.

Thanks in Advance.;)
If you want to share which rows of which sheets, I will share the code to amalgamate them to a separate sheet.
 
Upvote 0
Thanks for lending a helping hand.

The worksheets can have varying no. of rows across 10 cols (starting from col A). All worksheets will have exactly 10 cols.

The worksheets will be labelled Worksheet A, Worksheet B, Worksheet C....etc.

Hope this helps to formulate a code.
 
Upvote 0
The objective is still vague but here is generic code that perhaps you can work with to do what you want. The code assumes row 1 as header row.
Code:
Sub amalgamate()
Dim sh As Worksheet, nsh As Worksheet
Set nsh = Sheets.Add(Before:=Sheets(1))
    For Each sh In ThisWorkbook.Sheets
        If nsh.Application.CountA(Range("1:1")) = 0 Then
            sh.Rows(1).Copy nsh.Range("A1")
        End If
        sh.UsedRange.Offset(1).Copy nsh.Cells(Rows.Count, 1).End(xlUp)(2)
    Next
End Sub
 
Last edited:
Upvote 0
The objective is still vague but here is generic code that perhaps you can work with to do what you want. The code assumes row 1 as header row.
Code:
Sub amalgamate()
Dim sh As Worksheet, nsh As Worksheet
Set nsh = Sheets.Add(Before:=Sheets(1))
    For Each sh In ThisWorkbook.Sheets
        If nsh.Application.CountA(Range("1:1")) = 0 Then
            sh.Rows(1).Copy nsh.Range("A1")
        End If
        sh.UsedRange.Offset(1).Copy nsh.Cells(Rows.Count, 1).End(xlUp)(2)
    Next
End Sub

Thanks for figuring it out, code works like a charm !!;)
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top