Combine Multiple Worksheets

Nanogirl21

Active Member
Joined
Nov 19, 2013
Messages
331
Office Version
  1. 365
Platform
  1. Windows
I have 1 workbook with 8 worksheets. All worksheets are set up in the same format using columns A - Y. Is there any way that I can easily combine all worksheets into 1? On the new worksheet in column A I'd like the name of the orginal worksheet and the actual data to be from coumn B - Z. Thank you for the help.
 
Hello Nanogirl,

Try it as follows:-

Code:
Sub Test()

        Dim ws As Worksheet
        Dim sh As Worksheet: Set sh = Sheets("Combined")
        Dim lr As Long, sr As Long

Application.ScreenUpdating = False

For Each ws In Worksheets
        ws.[A1:L1].Copy sh.[B1]  '---->Change L1 to whatever your last column is (V1 I think?)
        sh.[A1] = "Source Sheet"
        If ws.Name <> "Combined" Then
        ws.[A1].CurrentRegion.Offset(1).Copy sh.Range("B" & Rows.Count).End(3)(2)
        lr = sh.Cells(sh.Rows.Count, "B").End(xlUp).Row
        sr = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row + 1
        sh.Range("A" & sr & ":A" & lr) = ws.Name
        End If
Next ws

sh.Columns.AutoFit

Application.ScreenUpdating = True

End Sub

I haven't added your create sheet line of code above. I'll leave that to you.

I hope that this helps.

Cheerio,
vcoolio.

This didn't work. I got "source sheet" for every cell in the new Combined worksheet.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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